edu.stanford.nlp.time
Class TimeAnnotator

java.lang.Object
  extended by edu.stanford.nlp.time.TimeAnnotator
All Implemented Interfaces:
Annotator

public class TimeAnnotator
extends java.lang.Object
implements Annotator

Annotate temporal expressions with SUTime. The expressions recognized by SUTime are loosely based on GUTIME. After annotation, the TimeAnnotations.TimexAnnotations annotation will be populated with a List<CoreMap>, each of which will represent one temporal expression. If a reference time is set (via CoreAnnotations.DocDateAnnotation), then temporal expressions are resolved with respect the to document date.


Input annotations

Annotation Type Description Required?
CoreAnnotations.DocDateAnnotation String If present, then the string is interpreted as a date/time and used as the reference document date with respect to which other temporal expressions are resolved Optional
CoreAnnotations.SentencesAnnotation List<CoreMap> If present, time expressions will be extracted from each sentence and each sentence will be annotated individually. Optional (good to have)
CoreAnnotations.TokensAnnotation List<CoreLabel> Tokens (for each sentence or for entire annotation if no sentences) Required
CoreAnnotations.TextAnnotation String Text (for each sentence or for entire annotation if no sentences) Optional
Per token annotations
CoreAnnotations.TextAnnotation String Token text (normalized) Required
CoreAnnotations.OriginalTextAnnotation String Token text (original) Required
CoreAnnotations.CharacterOffsetBeginAnnotation Integer The index of the first character of this token (0-based wrt to TextAnnotation of the annotation containing the TokensAnnotation). Required
CoreAnnotations.CharacterOffsetEndAnnotation Integer The index of the first character after this token (0-based wrt to TextAnnotation of the annotation containing the TokensAnnotation). Required
CoreAnnotations.PartOfSpeechAnnotation String Token part of speech Optional


Output annotations

Annotation Type Description
TimeAnnotations.TimexAnnotations List<CoreMap> List of temporal expressions (on the entire annotation and also for each sentence)
Per each temporal expression
TimeAnnotations.TimexAnnotation Timex Timex object with TIMEX3 XML attributes, use for exporting TIMEX3 information
TimeExpression.Annotation TimeExpression TimeExpression object. Use getTemporal() to get internal temporal representation.
TimeExpression.ChildrenAnnotation List<CoreMap> List of chunks forming this time expression (inner chunks can be tokens, nested time expressions, numeric expressions, etc)
CoreAnnotations.TextAnnotation String Text of this time expression
CoreAnnotations.TokensAnnotation List<CoreLabel> Tokens that make up this time expression
CoreAnnotations.CharacterOffsetBeginAnnotation Integer The index of the first character of this token (0-based).
CoreAnnotations.CharacterOffsetEndAnnotation Integer The index of the first character after this token (0-based).
CoreAnnotations.TokenBeginAnnotation Integer The index of the first token of this time expression (0-based).
CoreAnnotations.TokenEndAnnotation Integer The index of the first token after this time expression (0-based).


Constructor Summary
TimeAnnotator()
           
TimeAnnotator(java.lang.String name, java.util.Properties props)
           
 
Method Summary
 void annotate(Annotation annotation)
           
 java.util.List<CoreMap> annotateSingleSentence(CoreMap sentence, java.lang.String docDate, SUTime.TimeIndex timeIndex)
          Helper method for people not working from a complete Annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeAnnotator

public TimeAnnotator()

TimeAnnotator

public TimeAnnotator(java.lang.String name,
                     java.util.Properties props)
Method Detail

annotate

public void annotate(Annotation annotation)
Specified by:
annotate in interface Annotator

annotateSingleSentence

public java.util.List<CoreMap> annotateSingleSentence(CoreMap sentence,
                                                      java.lang.String docDate,
                                                      SUTime.TimeIndex timeIndex)
Helper method for people not working from a complete Annotation.

Returns:
a list of CoreMap. Each CoreMap represents a detected temporal expression.


Stanford NLP Group