Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
3.2
-
None
-
Window XP, Java 6, JBoss 4.2.3GA
-
New
Description
Problem: SpellChecker is not checking spelling of a word less than 3 characters. i.e "en", "am", "an", etc. So these words are getting misspelled in result.
Cause:
org.apache.lucene.search.spell.SpellChecker class is not adding in index dictionary a word which has less than 3 characters.
The method indexDictionary() in SpellChecker class is ignoring all the characters less than 3 characters length and not adding them in index dictionary.
Example code:
SpellChecker luceneSpellChecker = null;
luceneSpellChecker = new SpellChecker(new RAMDirectory(), new NGramDistance());
luceneSpellChecker.indexDictionary(
new PlainTextDictionary( new InputStreamReader(dictionaryFile, "UTF-8")),
10, 500, false);
System.out.println("Word 'an' exist? "+luceneSpellChecker.exist("an");
System.out.println("Word 'am' exist? "+luceneSpellChecker.exist("am");