Class ComplexNodePattern<M,K>
- java.lang.Object
-
- edu.stanford.nlp.ling.tokensregex.NodePattern<M>
-
- edu.stanford.nlp.ling.tokensregex.ComplexNodePattern<M,K>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CoreMapNodePattern,MapNodePattern
public class ComplexNodePattern<M,K> extends NodePattern<M>
Pattern for matching a complex data structure- Author:
- Angel Chang
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classComplexNodePattern.AbstractStringAnnotationPatternstatic classComplexNodePattern.AttributesEqualMatchChecker<K>static classComplexNodePattern.IntegerAnnotationPatternstatic classComplexNodePattern.NilAnnotationPatternstatic classComplexNodePattern.NotNilAnnotationPatternstatic classComplexNodePattern.NumericAnnotationPatternstatic classComplexNodePattern.SequenceRegexPattern<T>static classComplexNodePattern.StringAnnotationPatternstatic classComplexNodePattern.StringAnnotationRegexPatternstatic classComplexNodePattern.StringInSetAnnotationPattern-
Nested classes/interfaces inherited from class edu.stanford.nlp.ling.tokensregex.NodePattern
NodePattern.AnyNodePattern<T>, NodePattern.ConjNodePattern<T>, NodePattern.DisjNodePattern<T>, NodePattern.EqualsNodePattern<T>, NodePattern.NegateNodePattern<T>
-
-
Field Summary
-
Fields inherited from class edu.stanford.nlp.ling.tokensregex.NodePattern
ANY_NODE, CASE_INSENSITIVE, NORMALIZE, UNICODE_CASE
-
-
Constructor Summary
Constructors Constructor Description ComplexNodePattern(BiFunction<M,K,Object> getter, Pair<K,NodePattern>... annotationPatterns)ComplexNodePattern(BiFunction<M,K,Object> getter, List<Pair<K,NodePattern>> annotationPatterns)ComplexNodePattern(BiFunction<M,K,Object> getter, K key, NodePattern pattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(K c, NodePattern pattern)List<Pair<K,NodePattern>>getAnnotationPatterns()booleanmatch(M token)Returns true if the input node matches this patternprotected booleanmatch(M token, Map<K,Object> matchResults)ObjectmatchWithResult(M token)Returns result associated with the matchstatic NodePattern<String>newStringRegexPattern(String regex, int flags)protected voidpopulate(Env env, Map<String,String> attributes, Function<Pair<Env,String>,K> getKey)StringtoString()static <M,K>
ComplexNodePatternvalueOf(Env env, Map<String,String> attributes, BiFunction<M,K,Object> getter, Function<Pair<Env,String>,K> getKey)
-
-
-
Constructor Detail
-
ComplexNodePattern
public ComplexNodePattern(BiFunction<M,K,Object> getter, List<Pair<K,NodePattern>> annotationPatterns)
-
ComplexNodePattern
public ComplexNodePattern(BiFunction<M,K,Object> getter, Pair<K,NodePattern>... annotationPatterns)
-
ComplexNodePattern
public ComplexNodePattern(BiFunction<M,K,Object> getter, K key, NodePattern pattern)
-
-
Method Detail
-
getAnnotationPatterns
public List<Pair<K,NodePattern>> getAnnotationPatterns()
-
newStringRegexPattern
public static NodePattern<String> newStringRegexPattern(String regex, int flags)
-
valueOf
public static <M,K> ComplexNodePattern valueOf(Env env, Map<String,String> attributes, BiFunction<M,K,Object> getter, Function<Pair<Env,String>,K> getKey)
-
populate
protected void populate(Env env, Map<String,String> attributes, Function<Pair<Env,String>,K> getKey)
-
add
public void add(K c, NodePattern pattern)
-
match
public boolean match(M token)
Description copied from class:NodePatternReturns true if the input node matches this pattern- Specified by:
matchin classNodePattern<M>- Parameters:
token- - node to match- Returns:
- true if the node matches the pattern, false otherwise
-
matchWithResult
public Object matchWithResult(M token)
Description copied from class:NodePatternReturns result associated with the match- Overrides:
matchWithResultin classNodePattern<M>- Parameters:
token- node to match- Returns:
- null if not matched, TRUE if there is a match but no other result associated with the match. Any other value is treated as the result value of the match.
-
-