필터 지우기
필터 지우기

I copied porter stemmer code from the Github . The error is NOT ENOUGH INPUT ARGUMENTS.

조회 수: 1 (최근 30일)
FUNCTION CODE: ERROR IN THE 3RD LINE
function stem = porterdupe(instring)
global j;
b = instring;
k = length(b);
k0 = 1;
j = k;
% With this if statement, strings of length 1 or 2 don't go through the
% stemming process. Remove this conditional to match the published
% algorithm.
stem = b;
if k > 2
% Output displays per step are commented out.
%disp(sprintf('Word to stem: %s', b));
x = step1ab(b, k, k0);
%disp(sprintf('Steps 1A and B yield: %s', x{1}));
x = step1c(x{1}, x{2}, k0);
%disp(sprintf('Step 1C yields: %s', x{1}));
x = step2(x{1}, x{2}, k0);
%disp(sprintf('Step 2 yields: %s', x{1}));
x = step3(x{1}, x{2}, k0);
%disp(sprintf('Step 3 yields: %s', x{1}));
x = step4(x{1}, x{2}, k0);
%disp(sprintf('Step 4 yields: %s', x{1}));
x = step5(x{1}, x{2}, k0);
%disp(sprintf('Step 5 yields: %s', x{1}));
stem = x{1};
end
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 13일
You cannot run the code by clicking on Run or by using the menus to run it. You need to go to the command line and type in porterdupe and follow it by the string you want to process. For example,
porterdupe('hey there this is a string')

추가 답변 (0개)

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by