Parsing Engine

danbikel.parser
Class ModifierEvent

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

public class ModifierEvent
extends Object
implements TrainerEvent, Cloneable

A class to represent the modifier 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
ModifierEvent(Sexp sexp)
          Constructs a new object from the specified S-expression.
ModifierEvent(Word modHeadWord, Word headWord, Symbol modifier, SexpList previousMods, WordList previousWords, Symbol parent, Symbol head, SexpList subcat, boolean verbIntervening, boolean side)
          Constructs a new ModifierEvent object, settings its data members to the values specified.
ModifierEvent(Word modHeadWord, Word headWord, Symbol modifier, SexpList previousMods, WordList previousWords, Symbol parent, Symbol head, Subcat subcat, boolean verbIntervening, boolean side)
          Constructs a new ModifierEvent object, settings its data members to the values specified.
ModifierEvent(Word modHeadWord, Word headWord, Symbol modifier, SexpList previousMods, WordList previousWords, Symbol parent, Symbol head, Subcat subcat, Word prevPunc, Word prevConj, boolean isConjPConj, boolean verbIntervening, boolean headAdjacent, boolean side)
          Constructs a new ModifierEvent object for use when outputting training events in the format of Mike Collins’ parser, settings its data members to the values specified.
 
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 ModifierEvent object containing data members which are all pairwise-equal with the data members of this ModifierEvent 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 child nonterminal label.
 boolean headAdjacent()
          Returns whether the current modifier is adjacent to the head child.
 Word headWord()
          Returns the head word of the head child being modified.
 boolean isConjPConj()
          Returns the boolean that indicates whether the modifier is a conjunction that is part of a conjunction phrase.
 Word modHeadWord()
          Returns the head word of the modifier of this modifier event.
 Symbol modifier()
          Returns the nonterminal label of this modifier event.
 Symbol parent()
          Returns the parent nonterminal label.
 Word prevConj()
          Returns the previously-generated conjunction if this modifier is conjoined with the head of the phrase, or null if this modifier is not conjoined.
 SexpList previousMods()
          Returns a list of modifiers that have already been generated.
 WordList previousWords()
          Returns a list of the head words of modifiers that have already been generated.
 Word prevPunc()
          Returns the previously-generated punctuation word if this modifier follows one, or null.
 void setHeadWord(Word headWord)
          Sets the head word of the head child and parent.
 void setModHeadWord(Word modHeadWord)
          Sets the head word of the modifier.
 void setPreviousWords(WordList previousWords)
          Sets the previous words list.
 TrainerEvent shallowCopy()
          Returns a shallow copy of this event.
 boolean side()
          Returns the value of Constants.LEFT if this modifier lies on the left side of the head child, or the value of Constants.RIGHT if this modifier lies on the right side.
 Subcat subcat()
          Returns a list of arguments of the head child that have yet to be generated.
 String toString()
          Returns an S-expression of the form accepted by ModifierEvent(Sexp).
 boolean verbIntervening()
          Returns whether a verb has been generated in any of the subtrees generated between the current modifier and the head child.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifierEvent

public ModifierEvent(Sexp sexp)
Constructs a new object from the specified S-expression. The Sexp must be an instance of a list with the following format:
 (modHeadWord headWord modifier previousMods parent head subcat
  verbIntervening side)
 
where


ModifierEvent

public ModifierEvent(Word modHeadWord,
                     Word headWord,
                     Symbol modifier,
                     SexpList previousMods,
                     WordList previousWords,
                     Symbol parent,
                     Symbol head,
                     SexpList subcat,
                     boolean verbIntervening,
                     boolean side)
Constructs a new ModifierEvent object, settings its data members to the values specified.

Parameters:
modHeadWord - the head word of the modifying nonterminal of this modifier event
headWord - the head word of the head child being modified
modifier - the nonterminal label of the modifier
previousMods - a list of previous modifying nonterminal labels
parent - the parent nonterminal label
head - the head child nonterminal label
subcat - an ordered list of arguments of the head that have yet to be generated
verbIntervening - a boolean representing whether or a not a verb has been generated anywhere in the subtrees between the head child and the current modifier
side - a boolean that is equal to Constants.LEFT if this modifier lies on the left side of the head child or equal to Constants.RIGHT if this modifier lies on the right side

ModifierEvent

public ModifierEvent(Word modHeadWord,
                     Word headWord,
                     Symbol modifier,
                     SexpList previousMods,
                     WordList previousWords,
                     Symbol parent,
                     Symbol head,
                     Subcat subcat,
                     boolean verbIntervening,
                     boolean side)
Constructs a new ModifierEvent object, settings its data members to the values specified.

Parameters:
modHeadWord - the head word of the modifying nonterminal of this modifier event
headWord - the head word of the head child being modified
modifier - the nonterminal label of the modifier
previousMods - a list of previous modifying nonterminal labels
parent - the parent nonterminal label
head - the head child nonterminal label
subcat - a set of arguments on the specified side of the head that have yet to be generated
verbIntervening - a boolean representing whether or a not a verb has been generated anywhere in the subtrees between the head child and the current modifier
side - a boolean that is equal to Constants.LEFT if this modifier lies on the left side of the head child or equal to Constants.RIGHT if this modifier lies on the right side

ModifierEvent

public ModifierEvent(Word modHeadWord,
                     Word headWord,
                     Symbol modifier,
                     SexpList previousMods,
                     WordList previousWords,
                     Symbol parent,
                     Symbol head,
                     Subcat subcat,
                     Word prevPunc,
                     Word prevConj,
                     boolean isConjPConj,
                     boolean verbIntervening,
                     boolean headAdjacent,
                     boolean side)
Constructs a new ModifierEvent object for use when outputting training events in the format of Mike Collins’ parser, settings its data members to the values specified.

Parameters:
modHeadWord - the head word of the modifying nonterminal of this modifier event
headWord - the head word of the head child being modified
modifier - the nonterminal label of the modifier
previousMods - a list of previous modifying nonterminal labels
parent - the parent nonterminal label
head - the head child nonterminal label
subcat - a set of arguments on the specified side of the head that have yet to be generated
prevPunc - the previously-generated punctuation word or null if the last modifier was neither punctuation nor a conjunction
prevConj - the previously-generated conjunction or null if the last modifier was neither punctuation nor a conjunction
isConjPConj - indicates whether the previously-generated modifier was a conjunction that was part of a conjoined phrase as per the definitions of Mike Collins’ model
verbIntervening - a boolean representing whether or a not a verb has been generated anywhere in the subtrees between the head child and the current modifier
headAdjacent - indicates whether the current modifier is adjacent to the head child
side - a boolean that is equal to Constants.LEFT if this modifier lies on the left side of the head child or equal to Constants.RIGHT if this modifier lies on the right side
See Also:
Settings.outputCollins
Method Detail

modHeadWord

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

Specified by:
modHeadWord in interface TrainerEvent

headWord

public Word headWord()
Returns the head word of the head child being modified.

Specified by:
headWord in interface TrainerEvent

modifier

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


previousMods

public SexpList previousMods()
Returns a list of modifiers that have already been generated.


previousWords

public WordList previousWords()
Returns a list of the head words of modifiers that have already been generated.


parent

public Symbol parent()
Returns the parent nonterminal label.

Specified by:
parent in interface TrainerEvent

head

public Symbol head()
Returns the head child nonterminal label.


subcat

public Subcat subcat()
Returns a list of arguments of the head child that have yet to be generated.


prevPunc

public Word prevPunc()
Returns the previously-generated punctuation word if this modifier follows one, or null.


prevConj

public Word prevConj()
Returns the previously-generated conjunction if this modifier is conjoined with the head of the phrase, or null if this modifier is not conjoined.


isConjPConj

public boolean isConjPConj()
Returns the boolean that indicates whether the modifier is a conjunction that is part of a conjunction phrase.


verbIntervening

public boolean verbIntervening()
Returns whether a verb has been generated in any of the subtrees generated between the current modifier and the head child.


headAdjacent

public boolean headAdjacent()
Returns whether the current modifier is adjacent to the head child. This method is only appropriate when outputting Collins-format trainer events.

Returns:
whether the current modifier is adjacent to the head child.
See Also:
Settings.outputCollins

side

public boolean side()
Returns the value of Constants.LEFT if this modifier lies on the left side of the head child, or the value of Constants.RIGHT if this modifier lies on the right side.

Specified by:
side in interface TrainerEvent

setModHeadWord

public void setModHeadWord(Word modHeadWord)
Sets the head word of the modifier.

Parameters:
modHeadWord - the head word of the modifier

setHeadWord

public void setHeadWord(Word headWord)
Sets the head word of the head child and parent.

Specified by:
setHeadWord in interface TrainerEvent
Parameters:
headWord - the head word

setPreviousWords

public void setPreviousWords(WordList previousWords)
Sets the previous words list.

Parameters:
previousWords - the previous words list

equals

public boolean equals(Object o)
Returns true if the specified object is an instance of a ModifierEvent object containing data members which are all pairwise-equal with the data members of this ModifierEvent 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 ModifierEvent(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()
Returns a shallow copy of this event.

Specified by:
shallowCopy in interface TrainerEvent
Returns:
a shallow copy of this event

Parsing Engine

Author: Dan Bikel.