edu.stanford.nlp.trees
Class CollinsHeadFinder
java.lang.Object
|
+--edu.stanford.nlp.trees.CollinsHeadFinder
- All Implemented Interfaces:
- HeadFinder
- public class CollinsHeadFinder
- extends Object
- implements HeadFinder
Implements the HeadFinder found in Michael Collins' 1999 thesis.
Except: we've added a head rule for NX (returns rightmost), whereas
no rule for the head of NX is found in any of the versions of
Collins' head table that we have (did he perhaps use the NP rules
for NX?).
These rules are suitable for the Penn Treebank.
This code assumes that tree category labels are interned and
does comparisons with equality (==). It won't work if the category labels
are not interned. In particular, this also means that functional tags
should have been stripped.
10/28/2002 -- Category label identity checking now uses the
equals() method instead of ==, so not interning category labels
shouldn't break things anymore. (Roger Levy)
Method Summary |
Tree |
determineHead(Tree t)
Determine which daughter of the current parse tree is the head. |
static void |
main(String[] args)
Go through trees and determine their heads and print them. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollinsHeadFinder
public CollinsHeadFinder()
determineHead
public Tree determineHead(Tree t)
- Determine which daughter of the current parse tree is the head.
- Specified by:
determineHead
in interface HeadFinder
- Parameters:
t
- The parse tree to examine the daughters of.
If this is a leaf, null
is returned
- Returns:
- The daughter parse tree that is the head of
t
- See Also:
for a routine to call this and spread heads throughout a tree
main
public static void main(String[] args)
- Go through trees and determine their heads and print them.
Just for debuggin'
Use: java CollinsHeadFinder /wsj/07
Stanford NLP Group