lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathieu Lecarme <math...@garambrogne.net>
Subject Re: Questions about use of SpellChecker: Constructor and Simillarity...
Date Tue, 08 Apr 2008 15:22:07 GMT
Use shingleFilter.

I'm working on a wider SpellChecker, I'll post a third patch soon.
https://admin.garambrogne.net/projets/revuedepresse/browser/trunk/src/java

M.

dreampeppers99 a écrit :
> 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
>   


---------------------------------------------------------------------
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