0

I was working on a text-analysis project in R and needed a stemmer. I found a JAR-file of a java compilation of a snowball stemmer. Documentation:
http://lucene.apache.org/core/3_0_3/api/contrib-snowball/
Download link (bottom link):
http://www.java2s.com/Code/JarDownload/snowball/
Now, as far as I could tell, this R code should make a new stemmer object:

library(rJava)  
.jinit("D:\\myUser\\Documents\\snowball.jar")  
stemmer <- .jnew("org.tartarus.snowball.ext.EnglishStemmer")  

However the final line of code gives the following error:

Error in .jnew("org.tartarus.snowball.ext.EnglishStemmer") :   
  java.lang.ClassNotFoundException

After spending quite a lot of time on this (among others, reading the following post for help: https://darrenjw.wordpress.com/2011/01/01/calling-java-code-from-r/), I got stuck because I am not sure what the exact problem is. As far as I can tell, it could be in order of likelyhood:
1. a mistake in my code
2. an issues with dependancies
3. the JAR file is corrupted somehow

Can anyone give me some pointers on where the problem might lie?

Edit: answered, see comments. The class names in this specific jar-file are lowercase.

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139
dimpol
  • 545
  • 9
  • 21
  • Having no familiarity with rJava, could it just be that it's "englishStemmer", rather than "EnglishStemmer"? (The [lucene version](http://www.java2s.com/Code/JarDownload/lucene-snowball/) uses more standard naming conventions) – femtoRgon Sep 21 '16 at 20:16
  • Wow, that was it! Thanks! – dimpol Sep 22 '16 at 06:36

0 Answers0