lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Halbert <j...@su3analytics.com>
Subject Re: analysis filter wrapper
Date Thu, 14 May 2009 11:22:53 GMT
You can use your Analyzer to get a token stream from any text you give
it, just like Lucene does.

Something like:



String text = "your list of words to analyze and tokenize";

TokenStream ts = YOUR_ANALYZER.tokenStream(null, new
StringReader(text));
Token token = new Token();

while((ts.next(token)) != null) {
	String t = new String(token.termBuffer()).substring(0,
token.termLength());
	System.out.println("Got token " + t);
}



-----Original Message-----
From: Marek Rei <mr472@chu.cam.ac.uk>
Reply-To: java-user@lucene.apache.org
To: java-user@lucene.apache.org
Subject: analysis filter wrapper
Date: Thu, 14 May 2009 11:57:57 +0100

Hi,

I'm rather new to Lucene and could use some help.

My Analyzer uses a set of filters (PorterStemFilter, LowerCaseFilter,
WhitespaceTokenizer). I need to replicate the effect of these filters
outside of the normal Lucene pipeline. Basically I would like to input a
String from one end and get a processed String or String[] from the
other end.

Is there a good way to do this? I'm trying to figure it out myself but
in case I fail, maybe someone from here could give some advice?

Thank You!
Marek

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


Mime
View raw message