0

I'm new to Stanford NER and have some problems. I have downloaded Stanford Named Entity Recognizer version 3.6.0. It works, no problem. But I can't get a tagged text as an output file. Read about extracting data on this site: http://www.themacroscope.org/2.0/using-the-stanford-named-entity-recognizer-to-extract-data-from-texts (Windows user). Tried to do the same, but got a few errors in command line:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
        at edu.stanford.nlp.io.IOUtils.<clinit>(IOUtils.java:42)
        at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(Abstrac
tSequenceClassifier.java:1484)
        at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifierNoExcept
ions(AbstractSequenceClassifier.java:1497)
        at edu.stanford.nlp.ie.crf.CRFClassifier.main(CRFClassifier.java:3015)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 4 more

Can somebody explain what's wrong and how should I correct it? Thank you!

Community
  • 1
  • 1

2 Answers2

0

Your program is missing a logger dependency (or somehow it's being blocked by another dependency). I'd try adding it manually: http://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.21

Side note: you can also give a try to illinois-NER.

Daniel
  • 5,111
  • 6
  • 35
  • 69
  • Oh, Thank you very much for answering. I would be very grateful if you explain what exactly should I do with that file? I downloaded it from the link you gave. Sooo...? – Sandra Blackross Apr 30 '16 at 21:33
  • Depends; do you use maven? If so, I would add it as a maven dependency. – Daniel Apr 30 '16 at 23:58
0

You need to include the lib folder in your CLASSPATH. It contains the necessary jars.

StanfordNLPHelp
  • 8,471
  • 1
  • 9
  • 9
  • I added a path to lib folder by using code in command-line `c:\Users\Kas\Documents\Сашино\Дисциплинарка\Parser\stanford-ner-2015-12-09> set CLASSPATH=%CLASSPATH%;C:\Users\Kas\Documents\Сашино\Дисциплинарка\Parser\Stanford -ner-2015-12-09\lib` – Sandra Blackross May 01 '16 at 09:46
  • "C:\Users\Kas\Documents\Сашино\Дисциплинарка\Parser\Stanford -ner-2015-12-09\lib" - full path to lib folder. But it still doesn't work. I did something wrong, didn't I? I also tried to write a path to lib folder into "Windows --> Advanced Properties --> Environment variable --> CLASSPATH".But still doesn't work :( – Sandra Blackross May 01 '16 at 09:53
  • Here is an example of setting a CLASSPATH for Windows: java -cp "Test.jar;lib/*" my.package.MainClass – StanfordNLPHelp May 01 '16 at 13:22
  • This question could be helpful: http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath – StanfordNLPHelp May 01 '16 at 13:23
  • I think in your example you are missing the "*" – StanfordNLPHelp May 01 '16 at 13:23
  • Yeah, i read that topic before. Did as it was said there: java -cp "Test.jar;lib/*" my.package.MainClass (also i tried java -cp "lib\*" my.package.MainClass and java -cp "full-path-to-lib" my.package. MainClass). But command-line gives another error for every trying: `Error: Could not find or load main class my.package.MainClass` Or should there be anything else instead of "my.package.MainClass"? – Sandra Blackross May 01 '16 at 16:39
  • java -mx1000m -cp "stanford-ner.jar;lib/*" edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier classifiers\english.all.3class.distsim.crf.ser.gz -textFile path-of-your-input-file – StanfordNLPHelp May 02 '16 at 07:43
  • The above command should be run from within the directory you downloaded with all of the NER contents. – StanfordNLPHelp May 02 '16 at 07:46