Help with Custom Analyzer
- From: Ryan O'Hara <ohara (at) genome.chop.edu>
- Date: Mon, 16 Oct 2006 12:28:00 -0400
I have a few questions regarding writing a custom analyzer.
My situation is that I would like to use the StandardAnalyzer but
with some data-specific rules. I was wondering if there was a way of
telling the StandardAnalyzer to treat a string of text, that would
normally be tokenized into more than one token, as only one token
(maybe by inserting quotes around the text). For example, say the
StandardAnalyzer normally splits the string of text
ohara (at) genome.chop.edu into 4 tokens, but I want it to split the
string into only 1 token. Could I accomplish this by surrounding the
string with quotes or by using some other type of flag?
Another question I have is how do I modify the text being analyzed?
From how I interpreted what I have read (which could easily be off),
it looks like in order to accomplish what I have previously
described, I am going to have to add some code to my custom
analyzer's tokenStream method. I see that tokenStream() has a Field
and a Reader as parameters. Would the way I go about adding rules be
to edit the reader text? If so, would manipulation of the text be
easier if I were to convert the reader into a string?
Any help is greatly appreciated. Thanks.
-Ryan
---------------------------------------------------------------------
To start a new topic, e-mail: users (at) tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe (at) tomcat.apache.org
For additional commands, e-mail: users-help (at) tomcat.apache.org