public SUTime.Temporal apply(CoreMap chunk) {
   if (tokenPattern != null) {
     if (chunk.containsKey(TimeExpression.ChildrenAnnotation.class)) {
       return apply(chunk.get(TimeExpression.ChildrenAnnotation.class));
     } else {
       return apply(chunk.get(CoreAnnotations.NumerizedTokensAnnotation.class));
       //            return apply(chunk.get(CoreAnnotations.TokensAnnotation.class));
     }
   } else if (stringPattern != null) {
     return apply(chunk.get(CoreAnnotations.TextAnnotation.class));
   } else {
     return extract(null);
   }
 }
Esempio n. 2
0
  private void addMissingAnnotation(Annotation anno) {
    boolean useConstituency = CorefProperties.useConstituencyTree(props);
    final boolean LEMMATIZE = true;

    List<CoreMap> sentences = anno.get(CoreAnnotations.SentencesAnnotation.class);
    for (CoreMap sentence : sentences) {
      boolean hasTree = sentence.containsKey(TreeCoreAnnotations.TreeAnnotation.class);
      Tree tree = sentence.get(TreeCoreAnnotations.TreeAnnotation.class);

      if (!useConstituency) { // TODO: temp for dev: make sure we don't use constituency tree
        sentence.remove(TreeCoreAnnotations.TreeAnnotation.class);
      }
      if (LEMMATIZE && hasTree && useConstituency)
        treeLemmatizer.transformTree(tree); // TODO don't need?
    }
    corenlp.annotate(anno);
  }