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

QuoteAttribution Exceptions #554

Closed
ryan-gilbert opened this issue Oct 26, 2017 · 6 comments
Closed

QuoteAttribution Exceptions #554

ryan-gilbert opened this issue Oct 26, 2017 · 6 comments

Comments

@ryan-gilbert
Copy link

ryan-gilbert commented Oct 26, 2017

Context

  • Feature: CoreNLP server QuoteAttribution annotator
  • Models: current base, current english, current english kbp (10/24/17)
  • Build: ant, JDK .18
  • Version: Github (master 10/24/17)
  • OS: Ubuntu @ latest (Docker)

Reproduce

  • Send request to CoreNLP server with annotators set to 'quoteattribution'

Details

The QuoteAttribution annotator seems to be hard-coded into the CLI and inaccessible from CoreNLP server. Can anyone confirm this is the case? That's my assessment, but I know very little Java.

Initially, QuoteAttribution couldn't find the required file path props (family words, gender, animations), but I resolved it by changing the default (outdated?) path to each. Adding props or a props file during startup didn't work. Now, I'm getting a null pointer in Sieve.java because of a null character map, which seems to be caused by a missing Person. In the case of a missing character map, "Person" should be generated. I've confirmed the person in the text being used is being identified as a person in other methods at http://corenlp.run. I'm also getting the same null pointer error at http://corenlp.run, but I can't verify it's the same issue without a stack trace.

So at this point, I'm wondering if I have an incorrect setup, QuoteAttribution isn't fully integrated, or both. I also welcome any clarification regarding the requirement for a generated BookNLP file and solutions that work dynamically with the CoreNLP server.

I would appreciate any input on the subject. I'm willing to commit any improvements or documentation that come from the discussion. Obviously I don't know Java well, but I imagine those additions would be referential in nature.


Error

java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.handle(StanfordCoreNLPServer.java:770)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at edu.stanford.nlp.quoteattribution.Sieves.Sieve.createNameMatcher(Sieve.java:128)
at edu.stanford.nlp.quoteattribution.Sieves.Sieve.(Sieve.java:40)
at edu.stanford.nlp.quoteattribution.Sieves.QMSieves.QMSieve.(QMSieve.java:32)
at edu.stanford.nlp.quoteattribution.Sieves.QMSieves.TrigramSieve.(TrigramSieve.java:23)
at edu.stanford.nlp.pipeline.QuoteAttributionAnnotator.getQMMapping(QuoteAttributionAnnotator.java:220)
at edu.stanford.nlp.pipeline.QuoteAttributionAnnotator.annotate(QuoteAttributionAnnotator.java:206)
at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:76)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:652)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.lambda$handle$0(StanfordCoreNLPServer.java:752)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more

@ryan-gilbert ryan-gilbert changed the title QuoteAttribution Errors QuoteAttribution Exceptions Oct 26, 2017
@ryan-gilbert ryan-gilbert reopened this Oct 26, 2017
@muzny
Copy link

muzny commented Oct 26, 2017

I'm one of the creators of the quote attribution annotator. Unfortunately we have all left Stanford and so have other jobs on our plates at the moment. I will check up on this during the day tomorrow and try to provide some guidance.

@ryan-gilbert
Copy link
Author

Thanks, I really appreciate any insight you can provide. The feature is pivotal for a professional project, but I plan to commit any CoreNLP improvements that come as a result.

@J38
Copy link
Contributor

J38 commented Oct 26, 2017

What properties are you using? This error is likely caused because you are missing the ner,entitymentions annotators.

@J38
Copy link
Contributor

J38 commented Oct 26, 2017

This code works for me with current master branch:

package edu.stanford.nlp.examples;

import edu.stanford.nlp.coref.*;
import edu.stanford.nlp.coref.data.*;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.util.*;

import edu.stanford.nlp.pipeline.*;

import java.util.*;


public class QuoteAttributionExample {

  public static void main(String[] args) {
    Annotation document =
        new Annotation("John said, \"I like pizza!\"");
    Properties props = new Properties();
    props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitymentions,quote,quoteattribution");
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
    pipeline.annotate(document);
    for (CoreMap quote : document.get(CoreAnnotations.QuotationsAnnotation.class)) {
      System.out.println(quote);
      System.out.println(quote.get(QuoteAttributionAnnotator.SpeakerAnnotation.class));
    }
  }
}

@J38
Copy link
Contributor

J38 commented Oct 26, 2017

The NullPointer is probably because you haven't specified a list of characters, and you also haven't included ner,entitymentions in your annotators list, so there are no sources of people to attribute the quotes to. If you make sure when you run your server you include ner,entitymentions in the annotators list I think this will go away.

@J38 J38 closed this as completed Oct 27, 2017
@ryan-gilbert
Copy link
Author

That resolved the issue, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants