Pregunta

He agregado lucene 3.5.0 y cuando agregué un frasco separado para el analizador de bolas de nieve, aparece el siguiente error:

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)

Mi código incluye:

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 

¿Alguien puede ayudarme con esto?

¿Fue útil?

Solución

Gracias por la ayuda. Tengo una versión compatible ... Esto es

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top