System.out.println(typeAtt.type()); ??? And this typeAtt? Thanks!
--------------------------------------------------------------------- Mário André Instituto Federal de Educação, Ciência e Tecnologia de Sergipe - IFS Mestrando em MCC - Universidade Federal de Alagoas - UFAL http://www.marioandre.com.br/ Skype: mario-fa ---------------------------------------------------------------------------- ---------- -----Mensagem original----- De: AHMET ARSLAN [mailto:iori...@yahoo.com] Enviada em: quarta-feira, 30 de dezembro de 2009 15:26 Para: java-user@lucene.apache.org Assunto: Re: Question about TokenStream lucene 3.0 > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org