/** * 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; }
List<HunspellWord> words = dictionary.lookupWord(strippedWord, 0, length); if (words != null) { for (HunspellWord hunspellWord : words) {
/** * 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; }