0

I am creating a custom post tagger model for Italian language.

I get an error running the command to train the model:

damiano@damiano:~/stanford-postagger$ java -classpath stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger -prop /home/damiano/modelli/italian.tagger.props -model italian.tagger -trainFile italian.tagger.train
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at edu.stanford.nlp.io.IOUtils.<clinit>(IOUtils.java:41)
    at edu.stanford.nlp.util.StringUtils.argsToProperties(StringUtils.java:938)
    at edu.stanford.nlp.util.StringUtils.argsToProperties(StringUtils.java:891)
    at edu.stanford.nlp.tagger.maxent.TaggerConfig.<init>(TaggerConfig.java:128)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.main(MaxentTagger.java:1836)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 5 more

I found this command inside the README.txt

I also tried with -classpath stanford-postagger-3.6.0.jar but I had the same problem.

This is the folder content:

damiano@damiano:~/stanford-postagger$ dir
build.xml  LICENSE.txt  sample-input.txt          stanford-postagger-3.6.0-javadoc.jar  stanford-postagger-gui.bat  stanford-postagger.sh
data       models   sample-output.txt         stanford-postagger-3.6.0-sources.jar  stanford-postagger-gui.sh   TaggerDemo2.java
lib    README.txt   stanford-postagger-3.6.0.jar  stanford-postagger.bat            stanford-postagger.jar  TaggerDemo.java

What can I do?

EDIT

This is my prop file:

model = /home/damiano/modelli/italian.tagger
arch = generic,suffix(4),prefix(4),unicodeshapes(-1,1),unicodeshapeconjunction(-1,1),words(-2,-2),words(2,2)
trainFile = /home/damiano/modelli/italian.tagger.train
tagSeparator = _
encoding = utf-8
iterations = 100
openClassTags = B BN CC CS DD DE DI DQ DR E EA FB FC FF FS I N PC PD PE PI PP PQ PR RD RI T SA SP XH XM XE XX Ss Sp Sn As Ap An APs APp APn NOs NOp NOn SWs SWp SWn Vip Vip3 Vii Vii3 Vis Vis3 Vif Vif3 Vcp Vcp3 Vci Vci3 Vdp Vdp3 Vg Vp Vf Vm VAip VAip3 VAii VAii3 VAis Vis3 VAif VAif3 VAcp VAcp3 VAci VAci3 VAdp VAdp3 VAg VAp VAf VAm VMip VMip3 VMii VMii3 VMis VMis3 VMif VMif3 VMcp VMcp3 VMci VMci3 VMdp VMdp3 VMg VMp VMf VMm
tokenize = false
Dail
  • 4,622
  • 16
  • 74
  • 109
  • 1
    add all the .jar files you find in the /lib/ directory of the stanford pos tagger. – alvas Dec 28 '15 at 08:17
  • no worries, you can write the answer and accept it as a self-answered question =) I barely helped you with a comment. – alvas Dec 28 '15 at 15:08

2 Answers2

3

In version 3.6, we started using slf4j as a logging facade, but we unfortunately haven't yet updated a lot of documentation.... The slf4j jars are in the "lib" subdirectory. Try the following command:

$ java -classpath "stanford-postagger.jar:lib/*" edu.stanford.nlp.tagger.maxent.MaxentTagger -prop /home/damiano/modelli/italian.tagger.props -model italian.tagger -trainFile italian.tagger.train
Christopher Manning
  • 9,360
  • 34
  • 46
  • Dear Professor, it is an honour! :) Yeah It took 5 hours to build my Italian pos tagger model (around 44MB!), I will share this model because I did not find a CoreNLP pos tagger for italian. – Dail Dec 28 '15 at 22:57
  • 2
    Great, thanks. We'd be very pleased to have and distribute models for more languages. There are just practical limits to how many we can build and support ourselves.... – Christopher Manning Dec 29 '15 at 20:42
  • I should not do that, however, could you give me your authoritative opinion with http://stackoverflow.com/questions/34502517/what-does-ner-model-to-find-person-names-inside-a-resume-cv ? – Dail Dec 29 '15 at 21:34
  • 1
    Just as an addition, on Windows the classpath separator is semicolon instead of colon. – stenlytw Apr 03 '16 at 15:59
1

you are missing slf4j.jar from your classpath. slf4j is a logging libary which probably stanford-postagger uses.

Download it place it in your dir where your other jar files are and add it to classpath as well.

George Moralis
  • 518
  • 2
  • 12