@Test public void testStem() { System.out.println("stem"); String[] words = {"consign", "consigned", "consigning", "consignment", "consist", "consisted", "consistency", "consistent", "consistently", "consisting", "consists", "consolation", "consolations", "consolatory", "console", "consoled", "consoles", "consolidate", "consolidated", "consolidating", "consoling", "consolingly", "consols", "consonant", "consort", "consorted", "consorting", "conspicuous", "conspicuously", "conspiracy", "conspirator", "conspirators", "conspire", "conspired", "conspiring", "constable", "constables", "constance", "constancy", "constant", "knack", "knackeries", "knacks", "knag", "knave", "knaves", "knavish", "kneaded", "kneading", "knee", "kneel", "kneeled", "kneeling", "kneels", "knees", "knell", "knelt", "knew", "knick", "knif", "knife", "knight", "knightly", "knights", "knit", "knits", "knitted", "knitting", "knives", "knob", "knobs", "knock", "knocked", "knocker", "knockers", "knocking", "knocks", "knopp", "knot", "knots" }; String[] expResult = {"consign", "consign", "consign", "consign", "consist", "consist", "consist", "consist", "consist", "consist", "consist", "consol", "consol", "consol", "consol", "consol", "consol", "consolid", "consolid", "consolid", "consol", "consol", "consol", "conson", "consort", "consort", "consort", "conspicu", "conspicu", "conspir", "conspir", "conspir", "conspir", "conspir", "conspir", "const", "const", "const", "const", "const", "knack", "knackery", "knack", "knag", "knav", "knav", "knav", "knead", "knead", "kne", "kneel", "kneel", "kneel", "kneel", "kne", "knel", "knelt", "knew", "knick", "knif", "knif", "knight", "knight", "knight", "knit", "knit", "knit", "knit", "kniv", "knob", "knob", "knock", "knock", "knock", "knock", "knock", "knock", "knop", "knot", "knot" }; LancasterStemmer instance = new LancasterStemmer(); for (int i = 0; i < words.length; i++) { String result = instance.stem(words[i]); assertEquals(expResult[i], result); } }
@Override public String stem(String word) { word = cleanup(word.toLowerCase()); if ((word.length() > 3) && (stripPrefix)) { word = stripPrefixes(word); } if (word.length() > 3) { word = stripSuffixes(word); } return word; }
LancasterStemmer implements Stemmer { @Override public String stem(String word) { word = cleanup(word.toLowerCase()); if ((word.length() > 3) && (stripPrefix)) { word = stripPrefixes(word); } if (word.length() > 3) { word = stripSuffixes(word); } return word; } }
LancasterStemmer implements Stemmer { @Override public String stem(String word) { word = cleanup(word.toLowerCase()); if ((word.length() > 3) && (stripPrefix)) { word = stripPrefixes(word); } if (word.length() > 3) { word = stripSuffixes(word); } return word; } LancasterStemmer();  LancasterStemmer(boolean stripPrefix);  LancasterStemmer(InputStream customizedRules);  LancasterStemmer(InputStream customizedRules, boolean stripPrefix); }
LancasterStemmer implements Stemmer { @Override public String stem(String word) { word = cleanup(word.toLowerCase()); if ((word.length() > 3) && (stripPrefix)) { word = stripPrefixes(word); } if (word.length() > 3) { word = stripSuffixes(word); } return word; } LancasterStemmer();  LancasterStemmer(boolean stripPrefix);  LancasterStemmer(InputStream customizedRules);  LancasterStemmer(InputStream customizedRules, boolean stripPrefix); @Override String stem(String word); }
LancasterStemmer implements Stemmer { @Override public String stem(String word) { word = cleanup(word.toLowerCase()); if ((word.length() > 3) && (stripPrefix)) { word = stripPrefixes(word); } if (word.length() > 3) { word = stripSuffixes(word); } return word; } LancasterStemmer();  LancasterStemmer(boolean stripPrefix);  LancasterStemmer(InputStream customizedRules);  LancasterStemmer(InputStream customizedRules, boolean stripPrefix); @Override String stem(String word);  }