error using snowball in lucene

1.5k views Asked by At

I have added lucene 3.5.0 and when i added a seperate jar for the snowball analyzer i get the following 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)

My code includes :

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 

Can somebody help me out with this ?

1

There are 1 answers

0
CTsiddharth On BEST ANSWER

Thanks for the help .. I got a compatible version ... This is it