Closed hexingren closed 6 years ago
Hey,
What version of Java do you have installed? What version of CoreNLP do you have installed?
I was using Java 9 and CoreNLP v3.9.1.
It turned out that something happened to the NER tagger on the CoreNLP server side. The error message below pops out when I try to tag any sentence using the NER tagger via the web interface on http://localhost:9000.
""" edu.stanford.nlp.util.ReflectionLoading$ReflectionLoadingException: Error creating edu.stanford.nlp.time.TimeExpressionExtractorImpl """
Try running the CoreNLP server as instructed here but also add the flag
--add-modules java.se.ee
There's no way to do this via pynlp
currently but I will add it soon.
Alternatively you can use Java 8
I started the server using """ java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000 --add-modules java.se.ee """ and I was able to see the demo box at http://localhost:9000. When I input a sentence at http://localhost:9000, almost all the other taggers, i.e., POS, dependency parse, openie, worked.
However, the NER tagger threw the following exception. """ edu.stanford.nlp.util.ReflectionLoading$ReflectionLoadingException: Error creating edu.stanford.nlp.time.TimeExpressionExtractorImpl """
The detailed error message on the console is
"""
[pool-1-thread-1] INFO CoreNLP - [/0:0:0:0:0:0:0:1:51810] API call w/annotators tokenize,ssplit,pos,lemma,ner
James F. Thomas, III and Emily K. Cheung Thomas, husband and wife.
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[pool-1-thread-1] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.7 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator lemma
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ner
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [1.2 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [0.6 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [0.6 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.time.JollyDayHolidays - Initializing JollyDayHoliday for SUTime from classpath edu/stanford/nlp/models/sutime/jollyday/Holidays_sutime.xml as sutime.binder.1.
edu.stanford.nlp.util.ReflectionLoading$ReflectionLoadingException: Error creating edu.stanford.nlp.time.TimeExpressionExtractorImpl
at edu.stanford.nlp.util.ReflectionLoading.loadByReflection(ReflectionLoading.java:38)
at edu.stanford.nlp.time.TimeExpressionExtractorFactory.create(TimeExpressionExtractorFactory.java:60)
at edu.stanford.nlp.time.TimeExpressionExtractorFactory.createExtractor(TimeExpressionExtractorFactory.java:43)
at edu.stanford.nlp.ie.regexp.NumberSequenceClassifier.
Can you try appending the following option whilst constructing your pynlp.client.StanfordCoreNLP
object
annotators = 'ner, ' # + your other annotators
options = {"ner.useSUTime": False}
nlp = StanfordCoreNLP(annotators=annotators, options=options)
Nice catch!!! It worked.
Could you elaborate the magic here? What is useSUTime and why does it matter? Was the problem on the server side or the wrapper? I tried every Python wrapper of CoreNLP online and they all failed on NER (but worked for other annotators). Really want to know the reasons. Many thanks!
I'm not too sure to be honest. I based the suggestion off a closed issue on the original repository. For more info I would probably suggest opening an issue on the CoreNLP repository directly.
Thanks
Hello,
I received CoreNLPServerError when trying to make it work with Version 3.9.1 of CoreNLP. Does it support the latest version for NER? Thanks!