List of usage examples for org.apache.lucene.analysis.es SpanishAnalyzer tokenStream
public final TokenStream tokenStream(final String fieldName, final Reader reader)
fieldName, tokenizing the contents of reader. From source file:workTextIndexService.Procesamiento.java
public String normalizar(String texto) { resultN = ""; @SuppressWarnings("deprecation") SpanishAnalyzer analyzer = new SpanishAnalyzer(Version.LUCENE_4_10_1); try {//from w ww .j av a 2 s . c om TokenStream stream = analyzer.tokenStream(null, new StringReader(texto)); stream.reset(); while (stream.incrementToken()) { resultN = resultN + (stream.getAttribute(CharTermAttribute.class).toString()) + " "; } stream.close(); } catch (IOException e) { throw new RuntimeException(e); } return resultN.toLowerCase(); }