Package edu.stanford.nlp.time
Interface TimeExpressionExtractor
-
- All Known Implementing Classes:
TimeExpressionExtractorImpl
public interface TimeExpressionExtractorA TimeExpressionExtractor extracts a list of time expressions from a document annotation.- Author:
- Angel Chang
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<CoreMap>extractTimeExpressionCoreMaps(CoreMap annotation, CoreMap docAnnotation)Extract time expressions from a sentence in a document.List<CoreMap>extractTimeExpressionCoreMaps(CoreMap annotation, String docDate)Extract time expressions in a document (provided as a CoreMap Annotation).voidfinalize(CoreMap docAnnotation)Indicates that all annotations on the document has been completed Performs cleanup on the document annotation.voidinit(Options options)voidinit(String name, Properties props)
-
-
-
Method Detail
-
init
void init(String name, Properties props)
-
init
void init(Options options)
-
extractTimeExpressionCoreMaps
List<CoreMap> extractTimeExpressionCoreMaps(CoreMap annotation, CoreMap docAnnotation)
Extract time expressions from a sentence in a document. The document is assumed to contain the document date. The document is also used to hold stateful information (e.g. the index used by SUTime to generate timex ids). Both the sentence and document are provided as a CoreMap Annotation.- Parameters:
annotation- - Annotation holding tokenized text from which the time expressions are to be extracteddocAnnotation- - Annotation for the entire document Uses the following annotations: CoreAnnotations.DocDateAnnotation.class (String representing document date) TimeExpression.TimeIndexAnnotation.class (Holds index used to generate tids)- Returns:
- List of CoreMaps
-
extractTimeExpressionCoreMaps
List<CoreMap> extractTimeExpressionCoreMaps(CoreMap annotation, String docDate)
Extract time expressions in a document (provided as a CoreMap Annotation).- Parameters:
annotation- The annotation to run time expression extraction overdocDate- A date for the document to be used as a reference time.- Returns:
- A list of CoreMap. Each CoreMap represents a detected temporal
expression. Each CoreMap is a pipeline.Annotation, and you can get
various attributes of the temporal expression out of it. For example,
you can get the list of tokens with:
List<CoreMap> cm = extractTimeExpressionCoreMaps(annotation, docDate); List<CoreLabel> tokens = cm.get(CoreAnnotations.TokensAnnotation.class);
-
finalize
void finalize(CoreMap docAnnotation)
Indicates that all annotations on the document has been completed Performs cleanup on the document annotation.- Parameters:
docAnnotation- A document annotation.
-
-