edu.stanford.nlp.trees
Class ModCollinsHeadFinder
java.lang.Object
edu.stanford.nlp.trees.ModCollinsHeadFinder
- All Implemented Interfaces:
- HeadFinder
- public class ModCollinsHeadFinder
- extends Object
- implements HeadFinder
Implements a variant on the HeadFinder found in Michael Collins' 1999 thesis. This starts with
Collins' head finder. As in CollinsHeadFinder.java
, 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?). Changes:
- The
PRN rule used to just take the leftmost thing, we now have it choose the leftmost lexical
category (not the common punctuation etc.)
- Delete IN as a possible head of S, and add FRAG
(low priority)
- Place NN before QP in ADJP head rules (more to do for ADJP!)
- Place PDT
before RB and after CD in QP rules. Also prefer CD to DT or RB. And DT to RB
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 |
ModCollinsHeadFinder
public ModCollinsHeadFinder()
ModCollinsHeadFinder
public ModCollinsHeadFinder(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.ModCollinsHeadFinder treebankFilePath
- Parameters:
args
- The treebankFilePath
Stanford NLP Group