Class TokenMatcher
- java.lang.Object
-
- com.gengoai.hermes.extraction.regex.TokenMatcher
-
public class TokenMatcher extends Object
The TokenMatcher class allows for iterating of the matches, extracting the match or named-groups within the match, the starting and ending offset of the match, and conversion into a TokenMatch object which records the current state of the match.
- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenMatch
asTokenMatch()
int
end()
boolean
find()
HString
group()
List<HString>
group(String groupName)
Gets the list of HString associated with a named group.Set<String>
groupNames()
int
start()
-
-
-
Method Detail
-
asTokenMatch
public TokenMatch asTokenMatch()
- Returns:
- then current match as a
TokenMatch
-
end
public int end()
- Returns:
- The index of the end token associated with the match
-
find
public boolean find()
- Returns:
- True if the pattern finds a next match
-
group
public HString group()
- Returns:
- the span of text covering the match
-
group
public List<HString> group(String groupName)
Gets the list of HString associated with a named group.- Parameters:
groupName
- the group name- Returns:
- the list of matches
-
start
public int start()
- Returns:
- The index of the start token associated with the match
-
-