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.
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)
2003/02/10 -- Changed to use TreebankLanguagePack and to cut on
characters that set off annotations, so this should work even if
functional tags are still on nodes.
- Author:
- Christopher Manning
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()
CollinsHeadFinder
public CollinsHeadFinder(TreebankLanguagePack tlp)
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'.
Usage:
java edu.stanford.nlp.trees.CollinsHeadFinder treebankFilePath
- Parameters:
args
- The treebankFilePath
Stanford NLP Group