{"record":{"id":"1a0f7ee687a6ecdc","repo":"stanfordnlp/CoreNLP","slug":"docdate-mapping-file-failed-to-match-against-doc","errorCode":null,"errorMessage":"DocDate mapping file failed to match against ${docID}","messagePattern":"DocDate mapping file failed to match against (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/pipeline/DocDateAnnotator.java","lineNumber":103,"sourceCode":"      sb.append(\"regex=\");\n      sb.append(regex);\n    } else {\n      sb.append(\"no docDate finder\");\n    }\n    sb.append(']');\n    description = sb.toString();\n  }\n\n  @Override\n  public void annotate(Annotation annotation) {\n    String docID = annotation.get(CoreAnnotations.DocIDAnnotation.class);\n    if (docID == null)\n      docID = \"\";\n    String foundDocDate;\n    if (useMappingFile) {\n      foundDocDate = docIDToDocDate.get(docID);\n      if (foundDocDate == null) {\n        log.warn(\"DocDate mapping file failed to match against \" + docID);\n        foundDocDate = \"\";\n      }\n    } else if (useFixedDate || usePresentDate) {\n      foundDocDate = fixedDate;\n    } else if (useRegex) {\n      Matcher m = fileDocDatePattern.matcher(docID);\n      if (m.matches()) {\n        foundDocDate = m.group(1);\n        if (foundDocDate.length() == 8 && DATE_NO_HYPHENS_PATTERN.matcher(foundDocDate).matches()) {\n          foundDocDate = addHyphensToDate(foundDocDate);\n        }\n      } else {\n        log.warn(\"DocDate regex failed to match against \" + docID);\n        foundDocDate = \"\";\n      }\n    } else {\n      foundDocDate = \"\";\n    }","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/DocDateAnnotator.java#L85-L121","documentation":"DocDateAnnotator resolves a document's date (used by SUTime for temporal grounding) either from a mapping file (docID -> date), a fixed date, or a regex over the doc ID. When useMappingFile is on and the docID has no entry in the mapping, the annotator logs this warning and returns an empty doc date, degrading downstream relative-date resolution.","triggerScenarios":"annotate() is run on an Annotation whose doc ID (from DocIDAnnotator or the 'docid' key) is absent from the configured docdates mapping file, or the annotation has no doc ID at all (docID becomes empty string and matches nothing).","commonSituations":"Mapping file not regenerated after new documents were added; doc IDs formatted differently than the mapping keys (extensions, paths, case); the docid annotator not configured so the ID is missing entirely.","solutions":["Ensure the document IDs match the mapping-file keys exactly (check extensions, leading paths, case sensitivity).","Add the missing docID entries to the mapping file, or regenerate it for the current corpus.","Configure the sutime/bindir/docid pipeline so the DocIDAnnotator runs before DocDateAnnotator and sets the document ID.","If an exact per-document date is unavailable, switch to the fixed-date (docdate.fixedDate) or regex-based mode as a fallback."],"exampleFix":"// before: docID 'doc-001.txt' but mapping key is 'doc-001'\nprops.setProperty(\"docdate.mapping\", \"docdates.txt\");\n\n// after: normalize the ID before annotation, or add the exact key\nprops.setProperty(\"docdate.mapping\", \"docdates.txt\");\n// docdates.txt now contains: doc-001.txt\t2013-05-14","handlingStrategy":"fallback","validationCode":"// Confirm every docID has a mapping entry before annotation\nfor (String docId : docIds) {\n  if (!docIdToDocDate.containsKey(docId)) {\n    log.warn(\"No docdate mapping for \" + docId + \"; will fall back to empty date\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize doc IDs (strip extensions/paths) consistently between the mapping file and the corpus","Regenerate the mapping file whenever new documents are added","Configure the DocIDAnnotator so doc IDs are always set before DocDateAnnotator runs","Fall back to sutime's reference date or a fixed date when per-document dates are missing"],"tags":["nlp","temporal","configuration","mapping-file"],"backgroundTag":"record-not-found","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}