cristian.petroaca
cristian.petroaca

Reputation: 355

Exception when training relation extractor model from StanfordNLP

I'm trying to train my own model for the relation extractor feature from StanfordNLP as described here : http://nlp.stanford.edu/software/relationExtractor.shtml. The issue is that when I start the training I get the following exception:

PERCENTAGE OF TRAIN: 1.0
The reader log level is set to SEVERE
Adding annotator pos
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.0 sec].
Adding annotator lemma
Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ...done [0.9 sec].
Mar 25, 2015 9:23:36 PM edu.stanford.nlp.ie.machinereading.MachineReading makeResultsPrinters
INFO: Making result printers from
Mar 25, 2015 9:23:36 PM edu.stanford.nlp.ie.machinereading.MachineReading makeResultsPrinters
INFO: Making result printers from edu.stanford.nlp.ie.machinereading.RelationExtractorResultsPrinter
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: edu.stanford.nlp.ie.machinereading.RelationExtractorResultsPrinter
        at edu.stanford.nlp.ie.machinereading.MachineReading.makeResultsPrinters(MachineReading.java:771)
        at edu.stanford.nlp.ie.machinereading.MachineReading.makeResultsPrinters(MachineReading.java:756)
        at edu.stanford.nlp.ie.machinereading.MachineReading.makeMachineReading(MachineReading.java:235)
        at edu.stanford.nlp.ie.machinereading.MachineReading.main(MachineReading.java:106)
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.ie.machinereading.RelationExtractorResultsPrinter
        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)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at edu.stanford.nlp.ie.machinereading.MachineReading.makeResultsPrinters(MachineReading.java:768)
        ... 3 more

I'm using StanfordNLP 3.5.1 and indeed the class does not exist in the jar. I am using the roth.properties file as described in the link at the top and that contains the line:

relationResultsPrinters = edu.stanford.nlp.ie.machinereading.RelationExtractorResultsPrinter

I tried commenting out that line with the hope that the code will pick up the default printer but that is still RelationExtractorResultsPrinter.

Anyone got this working?

Thanks

Upvotes: 1

Views: 260

Answers (1)

Jon Gauthier
Jon Gauthier

Reputation: 25572

This is definitely our bad! This class will be included in the next release. For now, you can compile the class from the source distribution (GitHub link).

Upvotes: 1

Related Questions