Question: using the porter algorithm .How can you get a string and apply porter algorithm Example of strings: Fighting ,Playing Small sample of porter algorithm ,
using the porter algorithm .How can you get a string and apply porter algorithm
Example of strings: "Fighting ","Playing"
Small sample of porter algorithm , you can refrence the rest online. How can a string be passed down to this algorithm
/** * Stemmer, implementing the Porter Stemming Algorithm * * The Stemmer class transforms a word into its root form. The input * word can be provided a character at time (by calling add()), or at once * by calling one of the various stem(something) methods. */ class Stemmer { private char[] b; private int i, /* offset into b */ i_end, /* offset to end of stemmed word */ j, k; private static final int INC = 50; /* unit of size whereby b is increased */ public Stemmer() { b = new char[INC]; i = 0; i_end = 0; } /** * Add a character to the word being stemmed. When you are finished * adding characters, you can call stem(void) to stem the word. */ public void add(char ch) { if (i == b.length) { char[] new_b = new char[i+INC]; for (int c = 0; c < i; c++) new_b[c] = b[c]; b = new_b; } b[i++] = ch; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
