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 atiyeh soleimani <a....@yahoo.com> on 2012/05/28 08:35:26 UTC

How SynonymFilter works?

Dear all

I am going to find out how SynonymFilter in Lucene-analyzers 3.5 works and what exactly its output tokens are. 
Is there any sample code that shows how to fill SynonymMap and then use SynonymFilter to filter a sentence.
I appreciate any comment.

Thanks,
Atieh Soleimani 

Re: How SynonymFilter works?

Posted by Ian Lea <ia...@gmail.com>.
I didn't know that SynonymMap had gone all FST.

Looks like you need something along these lines

String base1 = "fast";
String syn1 = "rapid";
String base2 = "slow";
String syn2 = "sluggish";

SynonymMap.Builder sb = new SynonymMap.Builder(true);
sb.add(new CharsRef(base1), new CharsRef(syn1), true);
sb.add(new CharsRef(base2), new CharsRef(syn2), true);
SynonymMap smap = sb.build();


Hope that helps.  There may be an easier way.  Have you tried looking
at the source code/test cases?



--
Ian.


On Fri, Aug 10, 2012 at 6:24 PM, Ricardo <rr...@rand.org> wrote:
>
>
> Ian Lea <ian.lea <at> gmail.com> writes:
>
>>
>> Did you get an answer to this?  Looking at the lucene test cases can
>> be a good way of finding out things like this.  Reading Lucene In
>> Action is also highly recommended.  May not have the exact answer to
>> this question but will teach you how to find out.
>>
>> --
>> Ian.
>>
>> On Mon, May 28, 2012 at 7:35 AM, atiyeh soleimani <a.soleimani <at> yahoo.com>
> wrote:
>> > Dear all
>> >
>> > I am going to find out how SynonymFilter in Lucene-analyzers 3.5 works and
> what exactly its output tokens are.
>> > Is there any sample code that shows how to fill SynonymMap and then use
> SynonymFilter to filter a sentence.
>> > I appreciate any comment.
>> >
>> > Thanks,
>> > Atieh Soleimani
>>
>
> Ian,
>
> Did you ever figure this out. I'm poking around but I can't find any example nor
> get it to work. I'm stuck at creating the SynonymMap.
>
> Thanks,
>
> -ricardo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

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


Re: How SynonymFilter works?

Posted by Ricardo <rr...@rand.org>.

Ian Lea <ian.lea <at> gmail.com> writes:

> 
> Did you get an answer to this?  Looking at the lucene test cases can
> be a good way of finding out things like this.  Reading Lucene In
> Action is also highly recommended.  May not have the exact answer to
> this question but will teach you how to find out.
> 
> --
> Ian.
> 
> On Mon, May 28, 2012 at 7:35 AM, atiyeh soleimani <a.soleimani <at> yahoo.com> 
wrote:
> > Dear all
> >
> > I am going to find out how SynonymFilter in Lucene-analyzers 3.5 works and 
what exactly its output tokens are.
> > Is there any sample code that shows how to fill SynonymMap and then use 
SynonymFilter to filter a sentence.
> > I appreciate any comment.
> >
> > Thanks,
> > Atieh Soleimani
> 

Ian,

Did you ever figure this out. I'm poking around but I can't find any example nor 
get it to work. I'm stuck at creating the SynonymMap.

Thanks,

-ricardo


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


Re: How SynonymFilter works?

Posted by Ian Lea <ia...@gmail.com>.
Did you get an answer to this?  Looking at the lucene test cases can
be a good way of finding out things like this.  Reading Lucene In
Action is also highly recommended.  May not have the exact answer to
this question but will teach you how to find out.


--
Ian.


On Mon, May 28, 2012 at 7:35 AM, atiyeh soleimani <a....@yahoo.com> wrote:
> Dear all
>
> I am going to find out how SynonymFilter in Lucene-analyzers 3.5 works and what exactly its output tokens are.
> Is there any sample code that shows how to fill SynonymMap and then use SynonymFilter to filter a sentence.
> I appreciate any comment.
>
> Thanks,
> Atieh Soleimani

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