我添加了Lucene 3.5.0,在加添了雪球分析器的焦炭jar时,我有以下错误:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.lucene.analysis.snowball.SnowballAnalyzer.setOverridesTokenStreamMethod(Ljava/lang/Class;)V
at org.apache.lucene.analysis.snowball.SnowballAnalyzer.<init>(SnowballAnalyzer.java:46)
at org.apache.lucene.analysis.snowball.SnowballAnalyzer.<init>(SnowballAnalyzer.java:61)
at lucene.similarity.rank_stop.main(rank_stop.java:34)
我的法典包括:
Analyzer analyzers = new SnowballAnalyzer(Version.LUCENE_30,"English",StopAnalyzer.ENGLISH_STOP_WORDS_SET);
private static String analyze(String text) throws IOException {
int i=0;
String result="" ;
String[] term = new String[100] ;
TokenStream stream = analyzers.reusableTokenStream("contents",new StringReader(text));
CharTermAttribute charTermAttribute = stream.getAttribute(CharTermAttribute.class);
while (stream.incrementToken()) {
term[i] = charTermAttribute.toString();
result+=term[i]+" " ;
i++;
}
return result;
}
}
line2 = analyze(line2); // here line2 is a string that has to be analyzed
有些人能够帮助我这样做?