Closed solarbear123 closed 3 years ago
I do not know the asnwer... but I think that this may happens because of this line
props.setProperty("ner.useSUTime", "0");
this line means that we turn off sutime
in ner
(that probably affect ner in your case)
ner.useSUTime =
But if you remove this line, you will get an exception that I do not know how to fix... 😞
Unhandled Exception: edu.stanford.nlp.util.ReflectionLoading+ReflectionLoadingException: Error creating edu.stanford.nlp.time.TimeExpressionExtractorImpl ---> edu.stanford.nlp.util.MetaClass+ClassCreationException: MetaClass couldn't create public edu.stanford.nlp.time.TimeExpressionExtractorImpl(java.lang.String,java.util.Properties) with args [sutime, {}] ---> java.lang.reflect.InvocationTargetException
at __<Invoker>(Object[] )
at Java_sun_reflect_ReflectionFactory.FastConstructorAccessorImpl.newInstance(Object[] args)
at java.lang.reflect.Constructor.newInstance(Object[] initargs, CallerID )
at edu.stanford.nlp.util.MetaClass.ClassFactory.createInstance(Object[] params)
--- End of inner exception stack trace ---
at edu.stanford.nlp.util.MetaClass.ClassFactory.createInstance(Object[] params)
at edu.stanford.nlp.util.MetaClass.createInstance(Object[] objects)
at edu.stanford.nlp.util.ReflectionLoading.loadByReflection(String className, Object[] arguments)
--- End of inner exception stack trace ---
at edu.stanford.nlp.util.ReflectionLoading.loadByReflection(String className, Object[] arguments)
at edu.stanford.nlp.time.TimeExpressionExtractorFactory.create(String className, String name, Properties props)
at edu.stanford.nlp.time.TimeExpressionExtractorFactory.createExtractor(String name, Properties props)
at edu.stanford.nlp.ie.regexp.NumberSequenceClassifier..ctor(Properties props, Boolean useSUTime, Properties sutimeProps)
at edu.stanford.nlp.ie.NERClassifierCombiner..ctor(Boolean applyNumericClassifiers, Language nerLanguage, Boolean useSUTime, Boolean augmentRegexNER, Properties nscProps, String[] loadPaths)
at edu.stanford.nlp.pipeline.NERCombinerAnnotator..ctor(Properties properties)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.ner(Properties properties)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$getNamedAnnotators$44(Properties , AnnotatorImplementations )
at edu.stanford.nlp.pipeline.StanfordCoreNLP.__<>Anon6.apply(Object , Object )
at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$getDefaultAnnotatorPool$65(Entry , Properties , AnnotatorImplementations )
at edu.stanford.nlp.pipeline.StanfordCoreNLP.__<>Anon27.get()
at edu.stanford.nlp.util.Lazy.3.compute()
at edu.stanford.nlp.util.Lazy.get()
at edu.stanford.nlp.pipeline.AnnotatorPool.get(String name)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(Properties , Boolean , AnnotatorImplementations , AnnotatorPool )
at edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(Properties props, Boolean enforceRequirements, AnnotatorPool annotatorPool)
at edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(Properties props, Boolean enforceRequirements)
at edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(Properties props)
The issue is old but still without a proper fix https://stackoverflow.com/questions/28389564/stanford-corenlp-error-creating-edu-stanford-nlp-time-timeexpressionextractorimp/28459472
Tried sample code at https://github.com/sergey-tihon/Stanford.NLP.NET/blob/master/samples/Stanford.NLP.CoreNLP.CSharp/Program.cs, and tested it with the sentence "the economy grew by 2% last year". "Last year" was not recognized as a DATE.
In contrast, http://nlp.stanford.edu:8080/corenlp/process does NER "last year" as a DATE.