All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.nlp.ling.tokensregex.TokenSequenceMatcher Maven / Gradle / Ivy

Go to download

Stanford Parser processes raw text in English, Chinese, German, Arabic, and French, and extracts constituency parse trees.

There is a newer version: 3.9.2
Show newest version
package edu.stanford.nlp.ling.tokensregex;

import edu.stanford.nlp.util.CoreMap;

import java.util.List;

/**
 * Token Sequence Matcher for regular expressions for sequences over tokens
 *
 * @author Angel Chang
 */
public class TokenSequenceMatcher extends CoreMapSequenceMatcher {

 /* protected static Function, String> CORELABEL_LIST_TO_STRING_CONVERTER =
          new Function, String>() {
            public String apply(List in) {
              return (in != null)? ChunkAnnotationUtils.getTokenText(in, CoreAnnotations.TextAnnotation.class): null;
            }
          };     */

  public TokenSequenceMatcher(SequencePattern pattern, List tokens) {
    super(pattern, tokens);
    //   this.nodesToStringConverter = CORELABEL_LIST_TO_STRING_CONVERTER;
    this.nodesToStringConverter = COREMAP_LIST_TO_STRING_CONVERTER;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy