NoSuchFieldError while running NERDemo.java file

296 Views Asked by At

I am trying to run this program on Eclipse and it is giving following error:

Loading classifier from E:\corenlp\stanford-ner-2015-01-29\stanford-ner-2015-01-30\classifiers\english.all.3class.distsim.crf.ser.gz ... done [6.8 sec].
Exception in thread "main" java.lang.NoSuchFieldError: wordFunction
    at edu.stanford.nlp.sequences.ObjectBankWrapper.doBasicStuff(ObjectBankWrapper.java:136)
    at edu.stanford.nlp.sequences.ObjectBankWrapper.processDocument(ObjectBankWrapper.java:93)
    at edu.stanford.nlp.sequences.ObjectBankWrapper$WrappedIterator.next(ObjectBankWrapper.java:86)
    at edu.stanford.nlp.sequences.ObjectBankWrapper$WrappedIterator.next(ObjectBankWrapper.java:50)
    at edu.stanford.nlp.ie.AbstractSequenceClassifier.classifyToString(AbstractSequenceClassifier.java:542)
    at edu.stanford.nlp.ie.AbstractSequenceClassifier.classifyToString(AbstractSequenceClassifier.java:588)
    at NERDemo.main(NERDemo.java:87)

For clarity, line 87 is:

    System.out.println(classifier.classifyToString(str));

I am using latest versions of all NLP tools and have included all jar files in Build Path option in Eclipse. What should I do?

1

There are 1 best solutions below

0
On

I was getting same error to execute ParserDemo.java code available in stanford-parser. In order to resolve it, I downloaded the latest parser from here. Extracted zip file into some folder. Then I imported that project into eclipse by following steps:

File -> New -> Project -> Java -> Java project from existing Ant File -> Specify the folder containing build.xml file

I specified stanford-parser-3.4.1-sources.jar and stanford-parser-3.4.1-models.jar using 'Build Path'.

I hope these steps may give some clue about the problem.