public class TimeAnnotator extends java.lang.Object implements Annotator
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 to the document date. You set it on an
Annotation as follows:
annotation.set(CoreAnnotations.DocDateAnnotation.class, "2013-07-14");
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 |
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 |
Annotation | Type | Description |
---|---|---|
TimeAnnotations.TimexAnnotations |
List<CoreMap> |
List of temporal expressions (on the entire annotation and also for each sentence) |
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). |
DEFAULT_REQUIREMENTS, STANFORD_CDC_TOKENIZE, STANFORD_CLEAN_XML, STANFORD_COLUMN_DATA_CLASSIFIER, STANFORD_COREF, STANFORD_COREF_MENTION, STANFORD_DEPENDENCIES, STANFORD_DETERMINISTIC_COREF, STANFORD_DOCDATE, STANFORD_ENTITY_MENTIONS, STANFORD_GENDER, STANFORD_KBP, STANFORD_LEMMA, STANFORD_LINK, STANFORD_MWT, STANFORD_NATLOG, STANFORD_NER, STANFORD_OPENIE, STANFORD_PARSE, STANFORD_POS, STANFORD_QUOTE, STANFORD_QUOTE_ATTRIBUTION, STANFORD_REGEXNER, STANFORD_RELATION, STANFORD_SENTIMENT, STANFORD_SSPLIT, STANFORD_TOKENIZE, STANFORD_TOKENSREGEX, STANFORD_TRUECASE, STANFORD_UD_FEATURES
Constructor and Description |
---|
TimeAnnotator() |
TimeAnnotator(boolean quiet) |
TimeAnnotator(java.lang.String name,
java.util.Properties props) |
TimeAnnotator(java.lang.String name,
java.util.Properties props,
boolean quiet) |
Modifier and Type | Method and Description |
---|---|
void |
annotate(Annotation annotation)
Given an Annotation, perform a task on this 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.
|
java.util.Set<java.lang.Class<? extends CoreAnnotation>> |
requirementsSatisfied()
Returns a set of requirements for which tasks this annotator can
provide.
|
java.util.Set<java.lang.Class<? extends CoreAnnotation>> |
requires()
Returns the set of tasks which this annotator requires in order
to perform.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exactRequirements, unmount
public TimeAnnotator()
public TimeAnnotator(boolean quiet)
public TimeAnnotator(java.lang.String name, java.util.Properties props)
public TimeAnnotator(java.lang.String name, java.util.Properties props, boolean quiet)
public void annotate(Annotation annotation)
Annotator
public java.util.List<CoreMap> annotateSingleSentence(CoreMap sentence, java.lang.String docDate, SUTime.TimeIndex timeIndex)
public java.util.Set<java.lang.Class<? extends CoreAnnotation>> requires()
Annotator
public java.util.Set<java.lang.Class<? extends CoreAnnotation>> requirementsSatisfied()
Annotator
requirementsSatisfied
in interface Annotator