|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.trees.tregex.TreePattern
public class TreePattern
A TreePattern is a tgrep
-type pattern. Instances of
it can be matched against instances of the Tree
class.
Symbol | Meaning |
---|---|
A << B | A dominates B |
A >> B | A is dominated by B |
A < B | A immediately dominates B |
A > B | A is immediately dominated by B |
A $ B | A is a sister of B (and not equal to B) |
A .. B | A precedes B |
A . B | A immediately precedes B |
A <<, B | B is a leftmost descendent of A |
A <<- B | B is a rightmost descendent of A |
A >>, B | A is a leftmost descendent of B |
A >>- B | A is a rightmost descendent of B |
A <, B | B is the first child of A |
A >, B | A is the first child of B |
A <- B | B is the last child of A |
A >- B | A is the last child of B |
A <i B | B is the ith child of A (i > 0) |
A >i B | A is the ith child of B (i > 0) |
A <-i B | B is the ith-to-last child of A (i > 0) |
A >-i B | A is the ith-to-last child of B (i > 0) |
A <: B | B is the only child of A |
A $++ B | A is a left sister of B |
A $-- B | A is a right sister of B |
A $+ B | A is the immediate left sister of B |
A $- B | A is the immediate right sister of B |
A <+C B | A dominates B via an unbroken chain of (zero or more) nodes matching description C |
A >+C B | A is dominated by B via an unbroken chain of (zero or more) nodes matching description C |
A <<# B | B is a head of phrase A |
A >># B | A is a head of phrase B |
A <# B | B is the immediate head of phrase A |
A ># B | B is the immediate head of phrase A |
Note that the operators are implicitly left-associative, so that "S < VP < NP" is equivalent to "(S < VP) < NP", which matches something where both a VP and an NP are directly below the S (in no particular order), like
(S (NP (NNP Juan)) (VP (VBD tried)))If instead what you want is an NP below a VP below an S, you should write "S < (VP < NP)". Current known bugs/shortcomings:
Method Summary | |
---|---|
static TreePattern |
compile(String str)
Compiles the given tree expression into a TreePattern instance. |
boolean |
findNext()
|
static void |
main(String[] args)
Used to check how tree patterns are compiled, and how node descriptions are compiled into regular expressions. |
TreeMatcher |
matcher(Tree t)
Creates a TreeMatcher that can match
this pattern to the specified input tree. |
String |
pattern()
returns the tree-pattern expression from which the pattern was compiled. |
void |
reset(Tree root)
|
Tree |
returnMatch()
|
void |
setCurrentResult(edu.stanford.nlp.trees.tregex.TreePatternReturnValue currentResult)
|
String |
toString()
Returns a representation of the TreePattern |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public TreeMatcher matcher(Tree t)
TreeMatcher
that can match
this
pattern to the specified input tree.
public static TreePattern compile(String str)
TreePattern
instance.
public String toString()
toString
in class Object
public String pattern()
public void reset(Tree root)
public boolean findNext()
public Tree returnMatch()
public void setCurrentResult(edu.stanford.nlp.trees.tregex.TreePatternReturnValue currentResult)
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |