> Using PorterStemFilter and removing the stopwords, but how > can I use > TokenStream in release 3.0 (print the result this method). > > I tried to use: > > public static void main(String[] args) throws > IOException, > ParseException > { > StringReader sr = new > StringReader("The man is very good. He talked > about many thigs"); > PorterStemAnalyzer ps = new > PorterStemAnalyzer(); > TokenStream tokenstream = > ps.tokenStream(null, sr); > > //Tokenizer token = (Tokenizer) > ps.tokenStream(null, sr); > while(tokenstream.incrementToken()) > { > ???????? > } > > } > > Thanks.
You can use this method to display: public static void displayTokenStream(TokenStream tokenStream) throws IOException { TermAttribute termAtt = (TermAttribute) tokenStream.getAttribute(TermAttribute.class); TypeAttribute typeAtt = (TypeAttribute) tokenStream.getAttribute(TypeAttribute.class); while (tokenStream.incrementToken()) { System.out.print(termAtt.term()); System.out.print(' '); System.out.println(typeAtt.type()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org