donnerpeter commented on a change in pull request #2330: URL: https://github.com/apache/lucene-solr/pull/2330#discussion_r572676594
########## File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/GeneratingSuggester.java ########## @@ -33,44 +40,59 @@ */ class GeneratingSuggester { private static final int MAX_ROOTS = 100; - private static final int MAX_GUESSES = 100; + private static final int MAX_WORDS = 100; + private static final int MAX_GUESSES = 200; private final Dictionary dictionary; + private final SpellChecker speller; - GeneratingSuggester(Dictionary dictionary) { - this.dictionary = dictionary; + GeneratingSuggester(SpellChecker speller) { + this.dictionary = speller.dictionary; + this.speller = speller; } List<String> suggest(String word, WordCase originalCase, Set<String> prevSuggestions) { - List<WeightedWord> roots = findSimilarDictionaryEntries(word, originalCase); - List<WeightedWord> expanded = expandRoots(word, roots); - TreeSet<WeightedWord> bySimilarity = rankBySimilarity(word, expanded); + List<Weighted<DictEntry>> roots = findSimilarDictionaryEntries(word, originalCase); + List<Weighted<String>> expanded = expandRoots(word, roots); + TreeSet<Weighted<String>> bySimilarity = rankBySimilarity(word, expanded); return getMostRelevantSuggestions(bySimilarity, prevSuggestions); } - private List<WeightedWord> findSimilarDictionaryEntries(String word, WordCase originalCase) { - try { - IntsRefFSTEnum<IntsRef> fstEnum = new IntsRefFSTEnum<>(dictionary.words); - TreeSet<WeightedWord> roots = new TreeSet<>(); + private List<Weighted<DictEntry>> findSimilarDictionaryEntries( + String word, WordCase originalCase) { + TreeSet<Weighted<DictEntry>> roots = new TreeSet<>(); + processFST( Review comment: extracted FST traversal into a separate method ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org