I needed this myself not long time ago..
Here is a piece of code to get an Analyzer that will use a tokeniez and
an English stemmer, (for "bears" it will also return "bear" and vice
versa)


private static Analyzer createEnglishAnalyzer() {
return new Analyzer() {
        public TokenStream tokenStream(String fieldName, Reader reader)
{
                TokenStream result = new StandardTokenizer(reader);
                result = new StandardFilter(result);
                result = new LowerCaseFilter(result);
                result = new StopFilter(result,
StandardAnalyzer.STOP_WORDS);
                result = new SnowballFilter(result, "English");
                return result;
        }
};
}


__________________________________
   Matt

    

-----Original Message-----
From: Tony Qian [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 08, 2007 7:51 PM
To: java-user@lucene.apache.org
Subject: Re: Plural word search

*****  This message comes from the Internet Network *****


Erick,

thanks for information.

Tony

>From: "Erick Erickson" <[EMAIL PROTECTED]>
>Reply-To: java-user@lucene.apache.org
>To: java-user@lucene.apache.org
>Subject: Re: Plural word search
>Date: Thu, 8 Mar 2007 13:42:00 -0500
>
>as of 2.1, as I remember, you can use leading wildcards but ONLY
>you set a flag (see setAllowLeadingWildcard in QueryParser). Be
>aware of the TooManyClauses issue though (search the mail
>archive and you'll find many discussions of this issue).
>
>Erick
>
>On 3/8/07, Tony Qian <[EMAIL PROTECTED]> wrote:
>>
>>
>>Sachin,
>>
>>Thanks for quick response. Is there any code example i can take look?
I'm
>>not familiar with the technique you mentioned. My question is how the
>>analyzer knows "buss" is not a plural and bears is a plural.
>>
>>Lucene supports wildcard. However, we can not use wildcard at the
>>beginning
>>of search term such as *bear. is there a way to match *bear* (bear,
bears,
>>forbearance etc.) by search tern "bear"?
>>
>>thanks
>>
>> >From: "Kainth, Sachin" <[EMAIL PROTECTED]>
>> >Reply-To: java-user@lucene.apache.org
>> >To: <java-user@lucene.apache.org>
>> >Subject: RE: Plural word search
>> >Date: Thu, 8 Mar 2007 17:14:02 -0000
>> >
>> >Hi Tony,
>> >
>> >Lucene certainly does support it.  It just requires you to use a
>> >tokeniser that performs stemming such as any analyzer that uses
>> >PorterStemFilter.
>> >
>> >Sachin
>> >
>> >-----Original Message-----
>> >From: Tony Qian [mailto:[EMAIL PROTECTED]
>> >Sent: 08 March 2007 16:52
>> >To: java-user@lucene.apache.org
>> >Subject: Plural word search
>> >
>> >All,
>> >
>> >I'm evaluating Lucene as a full-text search engine for a project. I
got
>> >one of the requirements as following:
>> >
>> >4) Plural Literal Search
>> >If you use the plural of a term such as bears the results will
include
>> >matches to the plural term bears as well as the singular term bear.
>> >
>> >it seems to me we need to build a dictionary to support it. Does
Lucene
>> >support it?
>> >
>> >appreciate your help.
>> >
>> >Tony
>> >
>> >_________________________________________________________________
>> >Don't miss your chance to WIN 10 hours of private jet travel from
>> >Microsoft(r) Office Live
>> >http://clk.atdmt.com/MRT/go/mcrssaub0540002499mrt/direct/01/
>> >
>> >
>>
>---------------------------------------------------------------------
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>> >This email and any attached files are confidential and copyright
>>protected.
>> >If you are not the addressee, any dissemination of this
communication is
>> >strictly prohibited. Unless otherwise expressly agreed in writing,
>>nothing
>> >stated in this communication shall be legally binding.
>> >
>> >The ultimate parent company of the Atkins Group is WS Atkins plc.
>> >Registered in England No. 1885586.  Registered Office Woodcote
Grove,
>> >Ashley Road, Epsom, Surrey KT18 5BW.
>> >
>> >Consider the environment. Please don't print this e-mail unless you
>>really
>> >need to.
>> >
>>
>---------------------------------------------------------------------
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>>
>>_________________________________________________________________
>>Find a local pizza place, movie theater, and more....then map the best
>>route!
>>http://maps.live.com/?icid=hmtag1&FORM=MGAC01
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>

_________________________________________________________________
Find a local pizza place, movie theater, and more....then map the best
route! 
http://maps.live.com/?icid=hmtag1&FORM=MGAC01


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



============================================
Internet communications are not secure and therefore Fortis Banque Luxembourg 
S.A. does not accept legal responsibility for the contents of this message. The 
information contained in this e-mail is confidential and may be legally 
privileged. It is intended solely for the addressee. If you are not the 
intended recipient, any disclosure, copying, distribution or any action taken 
or omitted to be taken in reliance on it, is prohibited and may be unlawful. 
Nothing in the message is capable or intended to create any legally binding 
obligations on either party and it is not intended to provide legal advice.
============================================


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to