Class BasicSequenceMatchResult<T>
- java.lang.Object
-
- edu.stanford.nlp.ling.tokensregex.BasicSequenceMatchResult<T>
-
- All Implemented Interfaces:
SequenceMatchResult<T>,HasInterval<Integer>,MatchResult
- Direct Known Subclasses:
SequenceMatcher
public class BasicSequenceMatchResult<T> extends Object implements SequenceMatchResult<T>
Basic results for a Sequence Match- Author:
- Angel Chang
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBasicSequenceMatchResult.MatchedGroup-
Nested classes/interfaces inherited from interface edu.stanford.nlp.ling.tokensregex.SequenceMatchResult
SequenceMatchResult.GroupToIntervalFunc<MR extends MatchResult>, SequenceMatchResult.MatchedGroupInfo<T>
-
-
Field Summary
-
Fields inherited from interface edu.stanford.nlp.util.HasInterval
CONTAINS_FIRST_ENDPOINTS_COMPARATOR, ENDPOINTS_COMPARATOR, LENGTH_ENDPOINTS_COMPARATOR, LENGTH_GT_COMPARATOR, LENGTH_LT_COMPARATOR, NESTED_FIRST_ENDPOINTS_COMPARATOR
-
Fields inherited from interface edu.stanford.nlp.ling.tokensregex.SequenceMatchResult
DEFAULT_COMPARATOR, GROUP_AFTER_MATCH, GROUP_BEFORE_MATCH, LENGTH_COMPARATOR, OFFSET_COMPARATOR, ORDER_COMPARATOR, PRIORITY_COMPARATOR, PRIORITY_SCORE_LENGTH_ORDER_OFFSET_COMPARATOR, SCORE_COMPARATOR, SCORER, TO_INTERVAL
-
-
Constructor Summary
Constructors Constructor Description BasicSequenceMatchResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicSequenceMatchResult<T>copy()List<? extends T>elements()Returns the original sequence the match was performed on.intend()intend(int group)intend(String var)Returns the index of the next element after the subsequence captured by the given group during this match.Interval<Integer>getInterval()Returns the intervalintgetOrder()Stringgroup()Stringgroup(int group)Stringgroup(String var)Returns theStringrepresenting the matched group.intgroupCount()SequenceMatchResult.MatchedGroupInfo<T>groupInfo()SequenceMatchResult.MatchedGroupInfo<T>groupInfo(int group)SequenceMatchResult.MatchedGroupInfo<T>groupInfo(String var)ObjectgroupMatchResult(int group, int index)Returns an Object representing the result for the match for a particular node in a group.ObjectgroupMatchResult(String var, int index)Returns an Object representing the result for the match for a particular node in a group.List<Object>groupMatchResults()Returns a list of Objects representing the match results for the entire sequence.List<Object>groupMatchResults(int group)Returns a list of Objects representing the match results for the nodes in the group.List<Object>groupMatchResults(String var)Returns a list of Objects representing the match results for the nodes in the group.List<T>groupNodes()Returns the entire matched subsequence as a list.List<T>groupNodes(int group)Returns the matched group as a list.List<? extends T>groupNodes(String var)Returns the matched group as a list.ObjectgroupValue()Returns the value (some Object) associated with the entire matched sequence.ObjectgroupValue(int group)Returns the value (some Object) associated with the captured group.ObjectgroupValue(String var)Returns the value (some Object) associated with the captured group.ObjectnodeMatchResult(int index)Returns an Object representing the result for the match for a particular node.SequencePattern<T>pattern()Returns pattern used to create this sequence match resultdoublepriority()doublescore()voidsetOrder(int order)intstart()intstart(int group)intstart(String var)Returns the start index of the subsequence captured by the given group during this match.BasicSequenceMatchResult<T>toBasicSequenceMatchResult()
-
-
-
Method Detail
-
elements
public List<? extends T> elements()
Description copied from interface:SequenceMatchResultReturns the original sequence the match was performed on.- Specified by:
elementsin interfaceSequenceMatchResult<T>- Returns:
- The list that the match was performed on
-
pattern
public SequencePattern<T> pattern()
Description copied from interface:SequenceMatchResultReturns pattern used to create this sequence match result- Specified by:
patternin interfaceSequenceMatchResult<T>- Returns:
- the SequencePattern against which this sequence match result was matched
-
toBasicSequenceMatchResult
public BasicSequenceMatchResult<T> toBasicSequenceMatchResult()
- Specified by:
toBasicSequenceMatchResultin interfaceSequenceMatchResult<T>
-
copy
public BasicSequenceMatchResult<T> copy()
-
getInterval
public Interval<Integer> getInterval()
Description copied from interface:HasIntervalReturns the interval- Specified by:
getIntervalin interfaceHasInterval<T>- Returns:
- interval
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceSequenceMatchResult<T>
-
setOrder
public void setOrder(int order)
-
priority
public double priority()
- Specified by:
priorityin interfaceSequenceMatchResult<T>
-
score
public double score()
- Specified by:
scorein interfaceSequenceMatchResult<T>
-
start
public int start()
- Specified by:
startin interfaceMatchResult
-
start
public int start(int group)
- Specified by:
startin interfaceMatchResult
-
start
public int start(String var)
Description copied from interface:SequenceMatchResultReturns the start index of the subsequence captured by the given group during this match.- Specified by:
startin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- the index of the first element captured by the group,
or
-1if the match was successful but the group itself did not match anything or if there is no capturing group in the pattern with the given name
-
end
public int end()
- Specified by:
endin interfaceMatchResult
-
end
public int end(int group)
- Specified by:
endin interfaceMatchResult
-
end
public int end(String var)
Description copied from interface:SequenceMatchResultReturns the index of the next element after the subsequence captured by the given group during this match.- Specified by:
endin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- the index of the next element after the subsequence captured by the group,
or
-1if the match was successful but the group itself did not match anything or if there is no capturing group in the pattern with the given name
-
group
public String group()
- Specified by:
groupin interfaceMatchResult
-
group
public String group(int group)
- Specified by:
groupin interfaceMatchResult
-
group
public String group(String var)
Description copied from interface:SequenceMatchResultReturns theStringrepresenting the matched group.- Specified by:
groupin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- the matched group as a
Stringornullif there is no capturing group in the pattern with the given name
-
groupNodes
public List<T> groupNodes()
Description copied from interface:SequenceMatchResultReturns the entire matched subsequence as a list.- Specified by:
groupNodesin interfaceSequenceMatchResult<T>- Returns:
- the matched subsequence as a list
-
groupNodes
public List<T> groupNodes(int group)
Description copied from interface:SequenceMatchResultReturns the matched group as a list.- Specified by:
groupNodesin interfaceSequenceMatchResult<T>- Parameters:
group- The index of a capturing group in this matcher's pattern- Returns:
- the matched group as a list
-
groupNodes
public List<? extends T> groupNodes(String var)
Description copied from interface:SequenceMatchResultReturns the matched group as a list.- Specified by:
groupNodesin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- the matched group as a list
or
nullif there is no capturing group in the pattern with the given name
-
groupValue
public Object groupValue()
Description copied from interface:SequenceMatchResultReturns the value (some Object) associated with the entire matched sequence.- Specified by:
groupValuein interfaceSequenceMatchResult<T>- Returns:
- value associated with the matched sequence.
-
groupValue
public Object groupValue(int group)
Description copied from interface:SequenceMatchResultReturns the value (some Object) associated with the captured group.- Specified by:
groupValuein interfaceSequenceMatchResult<T>- Parameters:
group- The index of a capturing group in this matcher's pattern- Returns:
- value associated with the captured group.
-
groupValue
public Object groupValue(String var)
Description copied from interface:SequenceMatchResultReturns the value (some Object) associated with the captured group.- Specified by:
groupValuein interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- value associated with the captured group.
-
groupInfo
public SequenceMatchResult.MatchedGroupInfo<T> groupInfo()
- Specified by:
groupInfoin interfaceSequenceMatchResult<T>
-
groupInfo
public SequenceMatchResult.MatchedGroupInfo<T> groupInfo(int group)
- Specified by:
groupInfoin interfaceSequenceMatchResult<T>
-
groupInfo
public SequenceMatchResult.MatchedGroupInfo<T> groupInfo(String var)
- Specified by:
groupInfoin interfaceSequenceMatchResult<T>
-
groupCount
public int groupCount()
- Specified by:
groupCountin interfaceMatchResult
-
groupMatchResults
public List<Object> groupMatchResults()
Description copied from interface:SequenceMatchResultReturns a list of Objects representing the match results for the entire sequence.- Specified by:
groupMatchResultsin interfaceSequenceMatchResult<T>- Returns:
- the list of match results associated with the entire sequence
-
groupMatchResults
public List<Object> groupMatchResults(int group)
Description copied from interface:SequenceMatchResultReturns a list of Objects representing the match results for the nodes in the group.- Specified by:
groupMatchResultsin interfaceSequenceMatchResult<T>- Parameters:
group- The index of a capturing group in this matcher's pattern- Returns:
- the list of match results associated with the nodes for the captured group.
-
groupMatchResults
public List<Object> groupMatchResults(String var)
Description copied from interface:SequenceMatchResultReturns a list of Objects representing the match results for the nodes in the group.- Specified by:
groupMatchResultsin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's pattern- Returns:
- the list of match results associated with the nodes for the captured group.
-
nodeMatchResult
public Object nodeMatchResult(int index)
Description copied from interface:SequenceMatchResultReturns an Object representing the result for the match for a particular node. (actual Object returned depends on the type T of the nodes). For instance, for a CoreMap, the match result is returned as aMap<Class, Object>, while for String, the match result is typically a MatchResult.- Specified by:
nodeMatchResultin interfaceSequenceMatchResult<T>- Parameters:
index- The index of the element in the original sequence.- Returns:
- The match result associated with the node at the given index.
-
groupMatchResult
public Object groupMatchResult(int group, int index)
Description copied from interface:SequenceMatchResultReturns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as aMap<Class, Object>, while for String, the match result is typically a MatchResult.- Specified by:
groupMatchResultin interfaceSequenceMatchResult<T>- Parameters:
group- The index of a capturing group in this matcher's patternindex- The index of the element in the captured subsequence.- Returns:
- the match result associated with the node at the given index for the captured group.
-
groupMatchResult
public Object groupMatchResult(String var, int index)
Description copied from interface:SequenceMatchResultReturns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as aMap<Class, Object>, while for String, the match result is typically a MatchResult.- Specified by:
groupMatchResultin interfaceSequenceMatchResult<T>- Parameters:
var- The name of the capturing group in this matcher's patternindex- The index of the element in the captured subsequence.- Returns:
- the match result associated with the node at the given index for the captured group.
-
-