stanfordnlp/CoreNLP · warning

WARNING: No document date specified

Error message

WARNING: No document date specified

What it means

TimeExpressionExtractorImpl.extractTimeExpressionCoreMaps needs a reference document date to ground extracted time expressions. When the DocDateAnnotation and CalendarAnnotation are both absent and options.verbose is on, it logs 'WARNING: No document date specified' and proceeds without an anchor, degrading resolution of relative time expressions.

Solutions

  1. Set CoreAnnotations.DocDateAnnotation (e.g. via the docdate property or annotation.set) before time extraction.
  2. Fall back to setting CalendarAnnotation with the document's date.
  3. If no date is truly available, accept the warning or suppress it by turning off options.verbose.
  4. Infer a default document date from file mtime or content heuristics and inject it as DocDateAnnotation.

Example fix

// before
Map<String,String> props = new HashMap<>();
props.put("sutime.verbose", "true"); // warning shown, no docDate
// after
annotation.set(CoreAnnotations.DocDateAnnotation.class, "2024-06-01");
Defensive patterns

Strategy: validation

Validate before calling

if (docAnnotation.get(CoreAnnotations.DocDateAnnotation.class) == null && docAnnotation.get(CoreAnnotations.CalendarAnnotation.class) == null) {
  docAnnotation.set(CoreAnnotations.DocDateAnnotation.class, LocalDate.now().toString()); // or fail fast
}

Prevention

When it happens

Trigger: Invoking TimeAnnotator/TimeExpressionExtractorImpl on a document where neither DocDateAnnotation nor CalendarAnnotation is set, with the extractor's verbose option enabled.

Common situations: Verbose SUTime options in pipeline properties surfacing the warning that TimeAnnotator would otherwise show only when not quiet; batch processing documents lacking metadata; misconfigured pipelines skipping the docdate property.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/453b7493c4906155. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/time/TimeExpressionExtractorImpl.java:82

    SUTime.TimeIndex timeIndex; // initialized immediately below
    String docDate = null;
    if (docAnnotation != null) {
      timeIndex = docAnnotation.get(TimeExpression.TimeIndexAnnotation.class);
      if (timeIndex == null) {
        docAnnotation.set(TimeExpression.TimeIndexAnnotation.class, timeIndex = new SUTime.TimeIndex());
      }
      // default look for the sentence's forum post date
      // if it doesn't have one, back off to the document date
      if (annotation.get(CoreAnnotations.SectionDateAnnotation.class) != null) {
        docDate = annotation.get(CoreAnnotations.SectionDateAnnotation.class);
      } else {
        docDate = docAnnotation.get(CoreAnnotations.DocDateAnnotation.class);
      }
      if (docDate == null) {
        Calendar cal = docAnnotation.get(CoreAnnotations.CalendarAnnotation.class);
        if (cal == null) {
          if (options.verbose) {
            logger.warn("WARNING: No document date specified");
          }
        } else {
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd:hh:mm:ss");
          docDate = dateFormat.format(cal.getTime());
        }
      }
    } else {
      timeIndex = new SUTime.TimeIndex();
    }
    if (StringUtils.isNullOrEmpty(docDate)) {
      docDate = null;
    }
    if (timeIndex.docDate == null && docDate != null) {
      try {
        // TODO: have more robust parsing of document date?  docDate may not have century....
        // TODO: if docDate didn't change, we can cache the parsing of the docDate and not repeat it for every sentence
        timeIndex.docDate = SUTime.parseDateTime(docDate,true);
      } catch (Exception e) {

View on GitHub (pinned to 1b7edd19c4)