opennlp.tools.lang.english
Class HeadRules

java.lang.Object
  extended by opennlp.tools.lang.english.HeadRules
All Implemented Interfaces:
GapLabeler, HeadRules

public class HeadRules
extends java.lang.Object
implements HeadRules, GapLabeler

Class for storing the English head rules associated with parsing.


Constructor Summary
HeadRules(java.io.BufferedReader rulesReader)
          Creates a new set of head rules based on the specified reader.
HeadRules(java.lang.String ruleFile)
          Creates a new set of head rules based on the specified head rules file.
 
Method Summary
 Parse getHead(Parse[] constituents, java.lang.String type)
          Returns the head constituent for the specified constituents of the specified type.
 java.util.Set getPunctuationTags()
          Returns the set of punctuation tags.
 void labelGaps(java.util.Stack stack)
          Labels the constituents found in the stack with gap labels if appropiate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeadRules

public HeadRules(java.lang.String ruleFile)
          throws java.io.IOException
Creates a new set of head rules based on the specified head rules file.

Parameters:
ruleFile - the head rules file.
Throws:
java.io.IOException - if the head rules file can not be read.

HeadRules

public HeadRules(java.io.BufferedReader rulesReader)
          throws java.io.IOException
Creates a new set of head rules based on the specified reader.

Parameters:
rulesReader - the head rules reader.
Throws:
java.io.IOException - if the head rules reader can not be read.
Method Detail

getPunctuationTags

public java.util.Set getPunctuationTags()
Description copied from interface: HeadRules
Returns the set of punctuation tags. Attachment decisions for these tags will not be modeled.

Specified by:
getPunctuationTags in interface HeadRules
Returns:
the set of punctuation tags.

getHead

public Parse getHead(Parse[] constituents,
                     java.lang.String type)
Description copied from interface: HeadRules
Returns the head constituent for the specified constituents of the specified type.

Specified by:
getHead in interface HeadRules
Parameters:
constituents - The constituents which make up a constituent of the specified type.
type - The type of a constituent which is made up of the specifed constituents.
Returns:
The constituent which is the head.

labelGaps

public void labelGaps(java.util.Stack stack)
Description copied from interface: GapLabeler
Labels the constituents found in the stack with gap labels if appropiate.

Specified by:
labelGaps in interface GapLabeler
Parameters:
stack - The stack of un-completed constituents.


Copyright 2008 Jason Baldridge, Gann Bierner, and Thomas Morton. All Rights Reserved.