Skip to content

TimeExpressionExtractorFactory.isDefaultExtractorPresent() checks for class but not for resources #122

Open
@reckart

Description

@reckart

TimeExpressionExtractorFactory.isDefaultExtractorPresent() check if the class for the default time expression extractor is present (i.e. edu.stanford.nlp.time.TimeExpressionExtractorImpl which is in the CoreNLP jar and thus likely always present). It doesn't check though if the resources required by this extractor are present (in the "models" jar which may actually not be present).

When not having the models jar on the classpath and using alternative means of providing the NERClassifierCombiner with models then causes the auto-detection to fail with this exception:

Caused by: edu.stanford.nlp.util.ReflectionLoading$ReflectionLoadingException: Error creating edu.stanford.nlp.time.TimeExpressionExtractorImpl
    at edu.stanford.nlp.util.ReflectionLoading.loadByReflection(ReflectionLoading.java:40)
    at edu.stanford.nlp.time.TimeExpressionExtractorFactory.create(TimeExpressionExtractorFactory.java:57)
    at edu.stanford.nlp.time.TimeExpressionExtractorFactory.createExtractor(TimeExpressionExtractorFactory.java:38)
    at edu.stanford.nlp.ie.regexp.NumberSequenceClassifier.<init>(NumberSequenceClassifier.java:81)
    at edu.stanford.nlp.ie.regexp.NumberSequenceClassifier.<init>(NumberSequenceClassifier.java:73)
    at edu.stanford.nlp.ie.NERClassifierCombiner.<init>(NERClassifierCombiner.java:103)
       <snip>
    ... 32 more
Caused by: 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, {}]
    at edu.stanford.nlp.util.MetaClass$ClassFactory.createInstance(MetaClass.java:235)
    at edu.stanford.nlp.util.MetaClass.createInstance(MetaClass.java:380)
    at edu.stanford.nlp.util.ReflectionLoading.loadByReflection(ReflectionLoading.java:38)
    ... 46 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at edu.stanford.nlp.util.MetaClass$ClassFactory.createInstance(MetaClass.java:231)
    ... 48 more
Caused by: java.lang.RuntimeException: Error initializing binder 1
    at edu.stanford.nlp.time.Options.<init>(Options.java:92)
    at edu.stanford.nlp.time.TimeExpressionExtractorImpl.init(TimeExpressionExtractorImpl.java:45)
    at edu.stanford.nlp.time.TimeExpressionExtractorImpl.<init>(TimeExpressionExtractorImpl.java:39)
    ... 53 more
Caused by: java.lang.NullPointerException: Missing URL.
    at de.jollyday.HolidayManager.getInstance(HolidayManager.java:190)
    at edu.stanford.nlp.time.JollyDayHolidays.init(JollyDayHolidays.java:51)
    at edu.stanford.nlp.time.Options.<init>(Options.java:90)
    ... 55 more

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions