JUnit Test case:
public void testNephrologist() throws Exception {
SpellDictionaryHashMap spellDict = new SpellDictionaryHashMap();
spellDict.addWord("neurologist");
spellDict.addWord("nephrologist");
spellChecker = new SpellChecker(spellDict);
List<Word> words = spellChecker.getSuggestions("nefrologist", 200);
for (Word word : words) {
System.out.println("word=" + word.getWord() + ",cost=" + word.getCost());
}
}
returns the following result in the current release 0.5.2:
word=neurologist,cost=100
this is because the cost to transform "nefrologist" to "nephrologist" is 195 and the configured SPELL_THRESHOLD in the
configuration.properties file is set to 140, so it uses its configured value even though the caller is requesting a threshold of 200 in spellChecker.getSuggestions("nefrologist", 200).
I made some changes (patch attached) so the threshold setting entered by the caller is honored.
With the changes, the same test now returns:
word=neurologist,cost=100
word=nephrologist,cost=195
-sujit
Patch file for change described in patch report.