Skip to content

GetPatternsFromDataMultiClass: NullPointerException with unknown cause #1024

@aggarcia3

Description

@aggarcia3

Invoking GetPatternsFromDataMultiClass<SurfacePattern>.run(properties) on some corpora ends up always throwing a NullPointerException for the same reason. However, the processed named entity label when the exception is thrown is not the same between executions nor the first label that is processed, so I suspect some kind of race condition. Nevertheless, my suspicion doesn't seem to be the actual cause, because invoking the GetPatternsFromDataMultiClass<SurfacePattern>.run(properties) method in a synchronized block doesn't help (it is called from several threads in my code), neither reducing the numThreads property to 1.

In particular, the null pointer exception is caused by the setEn variable in the ScorePhrases.getSentences method being null. The stack trace of the exception is as follows:

java.lang.NullPointerException
	at [email protected]/edu.stanford.nlp.patterns.ScorePhrases.getSentences(ScorePhrases.java:347)
	at [email protected]/edu.stanford.nlp.patterns.ScorePhrases.applyPats(ScorePhrases.java:393)
	at [email protected]/edu.stanford.nlp.patterns.ScorePhrases.learnNewPhrasesPrivate(ScorePhrases.java:567)
	at [email protected]/edu.stanford.nlp.patterns.ScorePhrases.learnNewPhrases(ScorePhrases.java:172)
	at [email protected]/edu.stanford.nlp.patterns.GetPatternsFromDataMultiClass.iterateExtractApply4Label(GetPatternsFromDataMultiClass.java:2307)
	at [email protected]/edu.stanford.nlp.patterns.GetPatternsFromDataMultiClass.iterateExtractApply(GetPatternsFromDataMultiClass.java:2110)
	at [email protected]/edu.stanford.nlp.patterns.GetPatternsFromDataMultiClass.runNineYards(GetPatternsFromDataMultiClass.java:3310)
	at [email protected]/edu.stanford.nlp.patterns.GetPatternsFromDataMultiClass.run(GetPatternsFromDataMultiClass.java:3290)
	at [my code]

Can someone point me to the right direction to fix this problem? It's urgent to me. Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions