public abstract class SemgrexMatcher extends Object
SemgrexMatcher
can be used to match a SemgrexPattern
against a SemanticGraph
.
Usage should be the same as Matcher
. Modifier and Type | Method and Description |
---|---|
boolean |
find()
Find the next match of the pattern in the graph
|
boolean |
findNextMatchingNode()
Find the next match of the pattern in the graph such that the matching node
(that is, the node matching the root node of the pattern) differs from the
previous matching node.
|
SemanticGraph |
getGraph()
Returns the graph associated with this match.
|
abstract IndexedWord |
getMatch()
Get the last matching node -- that is, the node that matches the root node
of the pattern.
|
IndexedWord |
getNode(String name)
Returns the node labeled with
name in the pattern. |
Set<String> |
getNodeNames()
Returns the set of names for named nodes in this pattern.
|
Set<String> |
getRelationNames()
Returns the set of names for named relations in this pattern.
|
String |
getRelnString(String name) |
abstract boolean |
matches()
Does the pattern match the graph? It's actually closer to
java.util.regex's "lookingAt" in that the root of the graph has to match
the root of the pattern but the whole tree does not have to be "accounted
for".
|
boolean |
matchesAt(IndexedWord node)
Rests the matcher and tests if it matches in the graph when rooted at
node . |
void |
reset()
Resets the matcher so that its search starts over.
|
abstract String |
toString() |
public void reset()
public abstract boolean matches()
public boolean matchesAt(IndexedWord node)
node
.public abstract IndexedWord getMatch()
public boolean find()
public boolean findNextMatchingNode()
public IndexedWord getNode(String name)
name
in the pattern.name
- the name of the node, specified in the pattern.public Set<String> getNodeNames()
public Set<String> getRelationNames()
public SemanticGraph getGraph()