stanfordnlp/CoreNLP · warning
QuoteAttribution doCoreference: Null pronounCorefMap
Error message
QuoteAttribution doCoreference: Null pronounCorefMap
What it means
Sieve.doCoreference resolves pronouns to people using pronounCorefMap, which is populated by a prior coreference sieve pass. If the map was never initialized (coreference not run or setup skipped), the method logs a warning and returns null instead of throwing, leaving the quote without a resolved speaker.
Solutions
- Ensure the coreference sieve stage runs before sieves that call doCoreference so pronounCorefMap is populated.
- Check the QuoteAttributionAnnotator options — do not disable coreference (e.g. markCoref=false) when sieves need it.
- Guard call sites: treat a null return from doCoreference as 'no speaker' rather than propagating it.
- If invoking Sieve directly, initialize pronounCorefMap yourself before calling doCoreference.
Example fix
// before
Person speaker = sieve.doCoreference(key, quote);
// after
if (corefRun) {
Person speaker = sieve.doCoreference(key, quote);
if (speaker == null) { /* quote skipped: coref unavailable */ }
} Defensive patterns
Strategy: type-guard
Validate before calling
if (pronounCorefMap == null) { throw new IllegalStateException("Run the coreference sieve before doCoreference"); } Type guard
if (pronounCorefMap == null) return null; // caller must null-check
Try / catch
Person speaker = sieve.doCoreference(key, quote);
if (speaker == null) { log.warn("coreference map missing or no antecedent; quote left unattributed"); } Prevention
- Always run quote-attribution sieves in the documented order (coreference first)
- Do not disable coreference in QuoteAttributionAnnotator options when using pronoun sieves
- Null-check the Person returned by doCoreference at every call site
When it happens
Trigger: Calling doCoreference (directly or via quote attribution sieves) before the pass that builds pronounCorefMap, or constructing Sieve subclasses without running the coreference stage.
Common situations: Custom pipelines that call quote-attribution sieves out of order; disabling the coreference sieve in AnnotatorPool options; reusing Sieve objects across documents without re-initialization.
Related errors
- Empty top speakers list for
- attempt to get word when sentence and lattice are null!
- Coreference is not implemented for Arabic
- Coreference is not implemented for Spanish
- after W derivative, index() != x.length()
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/677f4961870675ad.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/quoteattribution/Sieves/Sieve.java:101
int currQuoteParagraph = QuoteAttributionUtils.getQuoteParagraphIndex(doc, currQuote);
if (currQuoteParagraph == quoteParagraph) {
quoteNames.addAll(scanForNames(new Pair<>(currQuote.get(CoreAnnotations.TokenBeginAnnotation.class), currQuote.get(CoreAnnotations.TokenEndAnnotation.class))).first);
} else {
break;
}
}
Set<Person> namesInParagraph = new HashSet<>();
for (String name : quoteNames) {
namesInParagraph.addAll(characterMap.get(name));
}
// log.info("getNamesInParagraph for " + quote.toShorterString() + " got " + namesInParagraph);
return namesInParagraph;
}
public Person doCoreference(int corefMapKey, CoreMap quote) {
if (pronounCorefMap == null) {
log.warn("QuoteAttribution doCoreference: Null pronounCorefMap");
return null;
}
Set<Person> quoteNames = new HashSet<>();
if (quote != null) {
quoteNames = getNamesInParagraph(quote);
}
// log.info("Names in paragraph are: " + quoteNames);
String referent = pronounCorefMap.get(corefMapKey);
// log.info("pronounCorefMap lookup referent of charOffsetBegin " + corefMapKey + " is " + referent);
Person candidate = resolveAmbiguities(referent);
// log.info("Candidate is: " + candidate);
if (candidate != null && ! quoteNames.contains(candidate)) {
return candidate;
}
return null;
}
private static class TokenNode {View on GitHub (pinned to 1b7edd19c4)