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:

  1. The PRN rule used to just take the leftmost thing, we now have it choose the leftmost lexical category (not the common punctuation etc.)
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.


Constructor Summary
ModCollinsHeadFinder()
           
 
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
 

Constructor Detail

ModCollinsHeadFinder

public ModCollinsHeadFinder()
Method Detail

determineHead

public Tree determineHead(Tree t)
Determine which daughter of the current parse tree is the head. It assumes that category Strings for trees (as returned by t.label().value()) have been interned and can be compared with Penn Treebank label strings via ==.

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 ModCollinsHeadFinder /wsj/07



Stanford NLP Group