edu.stanford.nlp.ling.tokensregex.TokenSequenceMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stanford-parser Show documentation
Show all versions of stanford-parser Show documentation
Stanford Parser processes raw text in English, Chinese, German, Arabic, and French, and extracts constituency parse trees.
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 extends CoreLabel> in) {
return (in != null)? ChunkAnnotationUtils.getTokenText(in, CoreAnnotations.TextAnnotation.class): null;
}
}; */
public TokenSequenceMatcher(SequencePattern pattern, List extends CoreMap> tokens) {
super(pattern, tokens);
// this.nodesToStringConverter = CORELABEL_LIST_TO_STRING_CONVERTER;
this.nodesToStringConverter = COREMAP_LIST_TO_STRING_CONVERTER;
}
}