danbikel.parser.chinese
Class HeadFinder
java.lang.Object
danbikel.parser.lang.AbstractHeadFinder
danbikel.parser.chinese.HeadFinder
- All Implemented Interfaces:
- HeadFinder, Serializable
public class HeadFinder
- extends AbstractHeadFinder
A class for determining the head node on the right-hand sides of Chinese
parse tree productions.
- See Also:
- Serialized Form
| Fields inherited from class danbikel.parser.lang.AbstractHeadFinder |
defaultSym, fallbackDefaultHeadTableResource, headFindInstructions, headSuffix, LEFT, leftSym, postHeadSuffix, preHeadSuffix, probRandom, rand, RIGHT, rightSym, useRand, warnDefaultRule |
|
Constructor Summary |
HeadFinder()
Constructs an Chinese head-finding object, getting the name of the head
table from the value of
Settings.get(Settings.headTablePrefix + Language.getLanguage()). |
HeadFinder(Sexp headTableSexp)
Constructs an Chinese head-finding object with the specified head table. |
|
Method Summary |
int |
findHead(Sexp tree,
Symbol lhs,
SexpList rhs)
Finds the head for the grammar production lhs -> rhs. |
static void |
main(String[] args)
A test driver for this class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HeadFinder
public HeadFinder()
throws IOException,
FileNotFoundException
- Constructs an Chinese head-finding object, getting the name of the head
table from the value of
Settings.get(Settings.headTablePrefix + Language.getLanguage()).
The named head table is searched for in the locations that are searched
by the method Settings.getFileOrResourceAsStream(Class,String).
This constructor will be invoked upon the initialization of the
Language class.
- Throws:
IOException
FileNotFoundException- See Also:
Settings.getFileOrResourceAsStream(Class, String)
HeadFinder
public HeadFinder(Sexp headTableSexp)
- Constructs an Chinese head-finding object with the specified head table.
findHead
public int findHead(Sexp tree,
Symbol lhs,
SexpList rhs)
- Finds the head for the grammar production
lhs -> rhs. This
method destructively modifies rhs to contain only
the canonical version of each of its symbols. This method then calls
AbstractHeadFinder.defaultFindHead(Symbol,SexpList), using the canonical version
of the lhs symbol for the first argument. If the default
head index points to a nonterminal in a coordinating relationship, that
is, if the default head index is greater than 2 and the previous
nonterminal is a conjunction, then the index returned is the default
head index minus 2.
- Specified by:
findHead in interface HeadFinder- Specified by:
findHead in class AbstractHeadFinder
- Parameters:
tree - the original subtree in which to find the head child, or
null if the subtree is not availablelhs - the nonterminal label that is the left-hand side of a grammar
productionrhs - a list of symbols that is the right-hand side of a grammar
production
- Returns:
- the 1-based index of the head child in
rhs - See Also:
Treebank.isConjunction(Symbol)
main
public static void main(String[] args)
- A test driver for this class.
Author: Dan Bikel.