|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.trees.AbstractCollinsHeadFinder
public abstract class AbstractCollinsHeadFinder
A base class for Head Finders similar to the one described in Michael Collins' 1999 thesis. For a given constituent we perform
for categoryList in categoryLists for index = 1 to n [or n to 1 if R->L] for category in categoryList if category equals daughter[index] choose it. with a final default that goes with the direction (L->R or R->L) For most constituents, there will be only one category in the list, the exception being, in Collins' original version, NP. It is up to the overriding base class to initialize the map from constituent type to categoryLists, "nonTerminalInfo", in its constructor. Entries are presumed to be of type String[][]. Each String[] is a list of categories, except for the first entry, which specifies direction of traversal and must be one of "right", "left" or "rightdis" or "leftdis". "left" means search left-to-right by category and then by position "leftdis" means search left-to-right by position and then by category "right" means search right-to-left by category and then by position "rightdis" means search right-to-left by position and then by category 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)
Field Summary | |
---|---|
protected String[] |
defaultRule
|
protected HashMap |
nonTerminalInfo
|
protected TreebankLanguagePack |
tlp
|
Constructor Summary | |
---|---|
protected |
AbstractCollinsHeadFinder(TreebankLanguagePack tlp)
|
Method Summary | |
---|---|
Tree |
determineHead(Tree t)
Determine which daughter of the current parse tree is the head. |
protected Tree |
determineNonTrivialHead(Tree t)
|
protected Tree |
findMarkedHead(Tree t)
A way for subclasses for corpora with explicit head markings to return the explicitly marked head |
protected int |
postOperationFix(int headIdx,
Tree[] daughterTrees)
A way for subclasses to fix any heads under special conditions The default does nothing. |
protected Tree |
traverseLocate(Tree[] daughterTrees,
String[] how,
boolean deflt)
Attempt to locate head daughter tree from among daughters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final TreebankLanguagePack tlp
protected HashMap nonTerminalInfo
protected String[] defaultRule
Constructor Detail |
---|
protected AbstractCollinsHeadFinder(TreebankLanguagePack tlp)
Method Detail |
---|
protected Tree findMarkedHead(Tree t)
t
- a tree to find the head of
public Tree determineHead(Tree t)
determineHead
in interface HeadFinder
t
- The parse tree to examine the daughters of.
If this is a leaf, null
is returned
t
for a routine to call this and spread heads throughout a tree
protected Tree determineNonTrivialHead(Tree t)
protected Tree traverseLocate(Tree[] daughterTrees, String[] how, boolean deflt)
null
.
protected int postOperationFix(int headIdx, Tree[] daughterTrees)
headIdx
- the index of the proposed headdaughterTrees
- the array of daughter trees
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |