List of usage examples for org.apache.lucene.analysis.core StopFilter reset
@Override
public void reset() throws IOException
From source file:org.jboss.trumped.data.TikaSample.java
License:Open Source License
public static List<String> tokenizeString(Analyzer analyzer, String string) { List<String> result = new ArrayList<String>(); try {//w w w. j ava2s . c o m TokenStream stream = analyzer.tokenStream(null, new StringReader(string)); StopFilter stopFilter = new StopFilter(stream, StopWords.getSet()); stopFilter.reset(); while (stopFilter.incrementToken()) { result.add(stopFilter.getAttribute(CharTermAttribute.class).toString()); } stopFilter.close(); } catch (IOException e) { // not thrown b/c we're using a string reader... throw new RuntimeException(e); } return result; }