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 Michael Barbarelli <mb...@gmail.com> on 2007/04/13 07:03:29 UTC

custom stop word list for standard analyzer

I know this is a relatively fundamental thing to arrange, but I'm having
trouble.

Can I instantiate a standard analyzer with an argument containing my own
stop words?  If so, how?  Will they be appended to or override the built-in
stop words?

Or, do I have to modify the analyzer class itself and recompile?

Thanks.

Re: custom stop word list for standard analyzer

Posted by Chris Hostetter <ho...@fucit.org>.
: Apologies and thanks all at the same time, everyone.

No apologies neccessary, you're not the first person to be confused by
this, which is why I asked if you had any ideas on how we can improve hte
docs -- people who know the APIs inside and out aren't in the best
position to understand how to improve the documentation for new users.

any suggestions?




-Hoss


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


Re: custom stop word list for standard analyzer

Posted by Michael Barbarelli <mb...@gmail.com>.
Apologies and thanks all at the same time, everyone.

Mike


On 4/12/07, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> : Michael Barbarelli wrote:
> : > Can I instantiate a standard analyzer with an argument containing my
> own
> : > stop words?  If so, how?  Will they be appended to or override the
> built-in
>
> I'm relly suprised how often this question gets asked ... Michael (or
> anyone else for that matter) do you have any suggestions on how the
> javadocs could be improved to make this more clear?
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: custom stop word list for standard analyzer

Posted by Chris Hostetter <ho...@fucit.org>.
: Michael Barbarelli wrote:
: > Can I instantiate a standard analyzer with an argument containing my own
: > stop words?  If so, how?  Will they be appended to or override the built-in

I'm relly suprised how often this question gets asked ... Michael (or
anyone else for that matter) do you have any suggestions on how the
javadocs could be improved to make this more clear?


-Hoss


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


Re: custom stop word list for standard analyzer

Posted by Paul Cowan <co...@aconex.com>.
Michael Barbarelli wrote:
> Can I instantiate a standard analyzer with an argument containing my own
> stop words?  If so, how?  Will they be appended to or override the built-in
> stop words?

You can do it with one of the alternate constructors, and they'll 
override the build-in list.

---

String[] MY_WORDS = new String[] {"this", "that", "thing", "thloople"};

StandardAnalyzer a = new StandardAnalyzer(MY_WORDS);

---

There are also constructors that take a Set of strings, a file to take a 
word list from, or a Reader. If you want the existing words PLUS your 
own, it shouldn't be too hard...

---

Set words = new HashSet(Arrays.asList(StandardAnalyzer.STOP_WORDS));

words.add("thloople");

StandardAnalyzer a = new StandardAnalyzer(words);

---

or similar.

Cheers,

Paul

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