/** * Find the stem(s) of the provided word * * @param word Word to find the stems for * @return List of stems for the word */ public List<Stem> stem(String word) { return stem(word.toCharArray(), word.length()); }
/** * Find the stem(s) of the provided word * * @param word Word to find the stems for * @return List of stems for the word */ public List<Stem> stem(char word[], int length) { List<Stem> stems = new ArrayList<Stem>(); if (dictionary.lookupWord(word, 0, length) != null) { stems.add(new Stem(word, length)); } stems.addAll(stem(word, length, null, 0)); return stems; }
printStemResults(word, stemmer.stem(word.toCharArray(), word.length()));
stems.addAll(stem(strippedWord, length, affix.getAppendFlags(), ++recursionDepth));
/** * Find the unique stem(s) of the provided word * * @param word Word to find the stems for * @return List of stems for the word */ public List<Stem> uniqueStems(char word[], int length) { List<Stem> stems = new ArrayList<Stem>(); CharArraySet terms = new CharArraySet(dictionary.getVersion(), 8, dictionary.isIgnoreCase()); if (dictionary.lookupWord(word, 0, length) != null) { stems.add(new Stem(word, length)); terms.add(word); } List<Stem> otherStems = stem(word, length, null, 0); for (Stem s : otherStems) { if (!terms.contains(s.stem)) { stems.add(s); terms.add(s.stem); } } return stems; }
buffer = dedup ? stemmer.uniqueStems(termAtt.buffer(), termAtt.length()) : stemmer.stem(termAtt.buffer(), termAtt.length());