Parsing Engine

danbikel.parser
Class HeadEvent

java.lang.Object
  extended by danbikel.parser.HeadEvent
All Implemented Interfaces:
TrainerEvent, Serializable, Cloneable

public class HeadEvent
extends Object
implements TrainerEvent, Cloneable

A class to represent the head generation event implicit in the models supported by this parsing package. The class Trainer counts such events, from which other events are derived.

See Also:
Serialized Form

Constructor Summary
HeadEvent(Sexp sexp)
          Contructs a new object from the specified S-expression.
HeadEvent(Word headWord, Symbol parent, Symbol head, SexpList leftSubcat, SexpList rightSubcat)
          Constructs a new HeadEvent object, setting all its data members to the specified values.
HeadEvent(Word headWord, Symbol parent, Symbol head, Subcat leftSubcat, Subcat rightSubcat)
          Constructs a new HeadEvent object, settings all its data members to the specified values.
 
Method Summary
 Object clone()
          Returns a deep copy of this object.
 TrainerEvent copy()
          Returns a deep copy of this object.
 boolean equals(Object o)
          Returns true if the specified object is an instance of a HeadEvent object containing data members which are all pairwise-equal with the data members of this HeadEvent object, according to each data member's equals(Object) method.
 int hashCode()
          Returns the hash code of this object, calculated from the hash codes of all its data members.
 Symbol head()
          Returns the head nonterminal label of this head event.
 Word headWord()
          Returns the head word of this head event.
 Subcat leftSubcat()
          Returns the left subcategorization frame of this head event.
 Word modHeadWord()
          Returns null, as head events do not deal with modifier words.
 Symbol parent()
          Returns the parent nonterminal label of this head event.
 Subcat rightSubcat()
          Returns the right subcategorization frame of this head event.
 void setHeadWord(Word headWord)
          Sets the head word of this event, or does nothing if this TrainerEvent has no such object.
 TrainerEvent shallowCopy()
          Returns a shallow copy of this event of the same run-time type.
 boolean side()
          Throws an UnsupportedOperationException, as this is not a modifier event.
 String toString()
          Returns an S-expression of the form accepted by HeadEvent(Sexp).
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HeadEvent

public HeadEvent(Sexp sexp)
Contructs a new object from the specified S-expression. The Sexp must be an instance of a list with the following format:
 (headWord parent head leftSubcat rightSubcat) 
where

Parameters:
sexp - a list containing all the information necessary to construct this HeadEvent object

HeadEvent

public HeadEvent(Word headWord,
                 Symbol parent,
                 Symbol head,
                 SexpList leftSubcat,
                 SexpList rightSubcat)
Constructs a new HeadEvent object, setting all its data members to the specified values.

Parameters:
headWord - the head word
parent - the parent nonterminal label
head - the head nonterminal label
leftSubcat - an S-expression representation of the left subcategorization frame, to be converted to a Subcat instance via Subcats.get(SexpList)
rightSubcat - an S-expression representation of the right subcategorization frame, to be converted to a Subcat instance via Subcats.get(SexpList)

HeadEvent

public HeadEvent(Word headWord,
                 Symbol parent,
                 Symbol head,
                 Subcat leftSubcat,
                 Subcat rightSubcat)
Constructs a new HeadEvent object, settings all its data members to the specified values.

Parameters:
headWord - the head word
parent - the parent nonterminal label
head - the head nonterminal label
leftSubcat - the left subcategorization frame
rightSubcat - the right subcategorization frame
Method Detail

headWord

public Word headWord()
Returns the head word of this head event.

Specified by:
headWord in interface TrainerEvent

parent

public Symbol parent()
Returns the parent nonterminal label of this head event.

Specified by:
parent in interface TrainerEvent

head

public Symbol head()
Returns the head nonterminal label of this head event.


leftSubcat

public Subcat leftSubcat()
Returns the left subcategorization frame of this head event.


rightSubcat

public Subcat rightSubcat()
Returns the right subcategorization frame of this head event.


modHeadWord

public Word modHeadWord()
Returns null, as head events do not deal with modifier words.

Specified by:
modHeadWord in interface TrainerEvent

setHeadWord

public void setHeadWord(Word headWord)
Description copied from interface: TrainerEvent
Sets the head word of this event, or does nothing if this TrainerEvent has no such object.

Specified by:
setHeadWord in interface TrainerEvent
Parameters:
headWord - the word to set as the head word of this event

side

public boolean side()
Throws an UnsupportedOperationException, as this is not a modifier event.

Specified by:
side in interface TrainerEvent
Throws:
UnsupportedOperationException - because this is not a modifier event

equals

public boolean equals(Object o)
Returns true if the specified object is an instance of a HeadEvent object containing data members which are all pairwise-equal with the data members of this HeadEvent object, according to each data member's equals(Object) method.

Overrides:
equals in class Object

toString

public String toString()
Returns an S-expression of the form accepted by HeadEvent(Sexp).

Overrides:
toString in class Object

hashCode

public int hashCode()
Returns the hash code of this object, calculated from the hash codes of all its data members.

Overrides:
hashCode in class Object

clone

public Object clone()
Returns a deep copy of this object.

Overrides:
clone in class Object

copy

public TrainerEvent copy()
Returns a deep copy of this object.

Specified by:
copy in interface TrainerEvent

shallowCopy

public TrainerEvent shallowCopy()
Description copied from interface: TrainerEvent
Returns a shallow copy of this event of the same run-time type.

Specified by:
shallowCopy in interface TrainerEvent

Parsing Engine

Author: Dan Bikel.