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 Simon Wistow <si...@thegestalt.org> on 2007/01/11 00:52:59 UTC

Spelling Correction api

I've been reading through the spelling correction API and I'm confused. 
It looks like you tell it the directory to hold the spelling correction 
DB and then give it an IndexReader and a field to retrieve spelling 
suggestions from.

But then I'd have to redo that operation everytime a new document was 
indexed. There didn't seem to be any apparent way to incrementally add 
new documents without creating my own dictionary by splitting up words 
from the incoming document.

Is that the only way?

Simon



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


Re: Spelling Correction api

Posted by Chris Hostetter <ho...@fucit.org>.
(disclaimer: i've never acctaully used the SpellChecker contib, just read
the docs)

: I've been reading through the spelling correction API and I'm confused.
: It looks like you tell it the directory to hold the spelling correction
: DB and then give it an IndexReader and a field to retrieve spelling
: suggestions from.

not exactly: you start by constructing a SpellChecker instance specifying
the Directory it should use to store it's built up datastructures (which
just so happen to be a Lucene index with a special set of fields)

now you have an empty SpellChecker oject.

You can then call the indexDictionary method passing it anything you want
that impliments the Dictionary interface -- a handy LuceneDictionary
implimentations is provided so you can add all of hte words in a field of
your choice from an existing Lucene index.

now you've got a populated SpellChecker object that's usable.  you can
make other instances of it in the future by resuing the same Directory.

: But then I'd have to redo that operation everytime a new document was
: indexed. There didn't seem to be any apparent way to incrementally add
: new documents without creating my own dictionary by splitting up words
: from the incoming document.

just call the indexDictionary method again on some simple Dictionary
implimentation and the new words will be added.


-Hoss


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