Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShiftReduceParserQuery Throwing NPE in Pipeline #42

Closed
techscrub opened this issue Dec 7, 2014 · 3 comments
Closed

ShiftReduceParserQuery Throwing NPE in Pipeline #42

techscrub opened this issue Dec 7, 2014 · 3 comments

Comments

@techscrub
Copy link

I'm very excited about the new SR parser, and I'm trying to drop it into a StanfordCoreNLP pipeline, but it's throwing an NPE when it gets to ShiftReduceParserQuery. The same code works with the PCFG parser, and I'm using version 3.5.0. The only properties I'm applying are:

props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.put("parse.model", "edu/stanford/nlp/models/srparser/englishSR.ser.gz");
pipeline = new StanfordCoreNLP(props);

The stack trace leads to line 72 in the ShiftReduceParserQuery class:

Collection<ScoredObject<Integer>> predictedTransitions = parser.model.findHighestScoringTransitions(state, true, maxBeamSize, constraints);

I confirmed that parser.model is null here, even though the output says the model loads successfully. The relevant part of the output is below.

Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ...done [11.8 sec].
Adding annotator dcoref
java.lang.NullPointerException
    at edu.stanford.nlp.parser.shiftreduce.ShiftReduceParserQuery.parseInternal(ShiftReduceParserQuery.java:72)
    at edu.stanford.nlp.parser.shiftreduce.ShiftReduceParserQuery.parse(ShiftReduceParserQuery.java:47)
    at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:263)
    at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:215)
    at edu.stanford.nlp.pipeline.SentenceAnnotator.annotate(SentenceAnnotator.java:95)
    at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:68)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:408)
@AngledLuffa
Copy link
Contributor

Are you using the latest models?

If so, what query are you using that causes it to crash?

On Sun, Dec 7, 2014 at 8:40 AM, techscrub notifications@github.com wrote:

I'm very excited about the new SR parser, and I'm trying to drop it into a
StanfordCoreNLP pipeline, but it's throwing an NPE when it gets to
ShiftReduceParserQuery. The same code works with the PCFG parser, and I'm
using version 3.5.0. The only properties I'm applying are:

props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.put("parse.model", "edu/stanford/nlp/models/srparser/englishSR.ser.gz");
pipeline = new StanfordCoreNLP(props);

The stack trace leads to line 72 in the ShiftReduceParserQuery class:

Collection<ScoredObject> predictedTransitions = parser.model.findHighestScoringTransitions(state, true, maxBeamSize, constraints);

I confirmed that parser.model is null here, even though the output says
the model loads successfully. The relevant part of the output is below.

Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ...done [11.8 sec].
Adding annotator dcoref
java.lang.NullPointerException
at edu.stanford.nlp.parser.shiftreduce.ShiftReduceParserQuery.parseInternal(ShiftReduceParserQuery.java:72)
at edu.stanford.nlp.parser.shiftreduce.ShiftReduceParserQuery.parse(ShiftReduceParserQuery.java:47)
at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:263)
at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:215)
at edu.stanford.nlp.pipeline.SentenceAnnotator.annotate(SentenceAnnotator.java:95)
at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:68)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:408)


Reply to this email directly or view it on GitHub
#42.

@techscrub
Copy link
Author

I didn't realize the SR models had changed from 3.4 to 3.5. I put in the new models and it works perfectly. I really can't thank you enough for the help, and for creating the SR parser. I have an enormous amount of text to crunch, and the performance gain from the SR parser is a game changer.

@manning
Copy link
Member

manning commented Dec 17, 2014

Thanks! Great that you like it!

@manning manning closed this as completed Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants