lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dreampeppers99 <leandro.rhc...@gmail.com>
Subject Questions about use of SpellChecker: Constructor and Simillarity...
Date Tue, 08 Apr 2008 15:11:21 GMT

Hi,

I have two question about this GREAT tool.. (framework, library...
"whatever")
Well I decide put spell checker on my applications and I start to read some
papers and "found out" the Lucene project...

Anyway, I make it works, but I just want to know...

1º Why need I pass a Directory objecto (obligatory) on constructor of
SpellChecker?
2º Suposse that in my dictonary I had these words:

"The Lord of the Rings: The Two Towers"
"The Lord of the Rings: The Fellowship of the Ring"
"The Lord of the Rings: The Return of the King"

I just want to know how can I code something to "suggest" when user query
"The Lord of the Rings: The Two Towers" the application suggest: 

"The Lord of the Rings: The Fellowship of the Ring"
"The Lord of the Rings: The Return of the King"

It is possible just using the Lucene?

################ My Test Class ######################
SpellChecker spell;
spell= new SpellChecker(FSDirectory.getDirectory(".")); //why this... ?!!
spell.indexDictionary(new Dicionario());	

String[] l = spell.suggestSimilar(args[0],5);	

for (String vl : l ){
   System.out.println("Suggested : " + vl);
}
###############################################



############### My Dictionary######################
public class Dicionario implements
org.apache.lucene.search.spell.Dictionary{

public Iterator getWordsIterator(){
	List<String> lista = new ArrayList<String>();
	lista.add("peter");
	lista.add("spider man 3");
	lista.add("johnny depp");
	lista.add("the edge");
	lista.add("monk");
	lista.add("arnold schwarzenegger");
	return lista.iterator();
    }
}
###############################################

Thanks in advance... :D
-- 
View this message in context: http://www.nabble.com/Questions-about-use-of-SpellChecker%3A-Constructor-and-Simillarity...-tp16559731p16559731.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Mime
View raw message