Interface TimeExpressionExtractor

  • All Known Implementing Classes:
    TimeExpressionExtractorImpl

    public interface TimeExpressionExtractor
    A TimeExpressionExtractor extracts a list of time expressions from a document annotation.
    Author:
    Angel Chang
    • Method Detail

      • 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 extracted
        docAnnotation - - 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 over
        docDate - 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.