You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Moiz Chinoy <mo...@gmail.com> on 2009/07/14 13:28:10 UTC

Lucene - Spell Check...

Hi all,

I am new to lucene and trying the spell checker in contrib\spellchecker.

The problem is that if I enter a wrong word it gives me the correct
suggestion but if I enter the correct word, lucene gives me alternate
suggestion.

For e.g.
I have "tour" and "tours" both in the text. If I enter "tors", it
gives me "tours". Now if I enter "tour" it gives me "tours" and if I
enter "tours" it gives me "tour".

Below is the code snippet:

SpellChecker spellchecker = new
SpellChecker(FSDirectory.getDirectory("index1"));
spellchecker.indexDictionary(new LuceneDictionary(reader, "contents"));
String[] suggestions = spellchecker.suggestSimilar("tour", 5);

I am using StandardAnalyzer while indexing and searching.
Lucene Version: 2.4.1

-- 
Regards,
Moiz Chinoy.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org