Parsing Engine

danbikel.parser.ms
Class ModNonterminalModelStructure7

java.lang.Object
  extended by danbikel.parser.ProbabilityStructure
      extended by danbikel.parser.ms.ModNonterminalModelStructure7
All Implemented Interfaces:
Serializable

public class ModNonterminalModelStructure7
extends ProbabilityStructure

See Also:
Serialized Form

Field Summary
 
Fields inherited from class danbikel.parser.ProbabilityStructure
additionalData, defaultModelClassName, defaultModelConstructor, doPruning, estimates, futureList, futures, futuresWithSubcats, histories, historiesWithSubcats, historyList, lambdas, prevHistCount, topLevelCacheSize, transitions
 
Constructor Summary
ModNonterminalModelStructure7()
           
 
Method Summary
 ProbabilityStructure copy()
          Returns a deep copy of this object.
 boolean doCleanup()
          Indicates whether the Model class needs to invoke its cleanup method at the end of its deriveCounts method.
 Event getFuture(TrainerEvent trainerEvent, int backOffLevel)
          Extracts the future for the specified level of back-off from the specified trainer event.
 Event getHistory(TrainerEvent trainerEvent, int backOffLevel)
          Extracts the history context for the specified back-off level from the specified trainer event.
 ProbabilityStructure[] jointModel()
          Returns an array of other ProbabilityStructure objects for use in a JointModel instance, or null if this probability structure should not be composed with a JointModel instance.
 int maxEventComponents()
          Allows subclasses to specify the maximum number of event components, so that the constructor of this class may pre-allocate space in its internal, reusable MutableEvent objects (used for efficient event construction).
 Model newModel()
          Returns a newly-constructed Model object for this probability structure.
 int numLevels()
          Returns the number of back-off levels.
 boolean removeHistory(int backOffLevel, Event history)
          In order to gather statistics for words that appear as the head of the entire sentence when estimating p(w | t), the trainer "fakes" a modifier event, as though the root node of the observed tree was seen to modify the magical +TOP+ node.
 
Methods inherited from class danbikel.parser.ProbabilityStructure
cacheSize, defaultSmoothingParamsFilename, dontAddNewParameters, doPruning, getAdditionalData, getTopLevelCacheSize, getTransition, lambdaFudge, lambdaFudgeTerm, lambdaPenalty, priorLevel, removeFuture, removeTransition, saveSmoothingParameters, setAdditionalData, smoothingParametersFile, useSmoothingParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModNonterminalModelStructure7

public ModNonterminalModelStructure7()
Method Detail

maxEventComponents

public int maxEventComponents()
Description copied from class: ProbabilityStructure
Allows subclasses to specify the maximum number of event components, so that the constructor of this class may pre-allocate space in its internal, reusable MutableEvent objects (used for efficient event construction). The default implementation simply returns 1.

Overrides:
maxEventComponents in class ProbabilityStructure
Returns:
1 (subclasses should override this method)
See Also:
MutableEvent.ensureCapacity(int)

numLevels

public int numLevels()
Description copied from class: ProbabilityStructure
Returns the number of back-off levels.

Specified by:
numLevels in class ProbabilityStructure

getHistory

public Event getHistory(TrainerEvent trainerEvent,
                        int backOffLevel)
Description copied from class: ProbabilityStructure
Extracts the history context for the specified back-off level from the specified trainer event.

Specified by:
getHistory in class ProbabilityStructure
Parameters:
trainerEvent - the event for which a history context is desired for the specified back-off level
backOffLevel - the back-off level for which to get a history context from the specified trainer event
Returns:
an Event object that represents the history context for the specified back-off level

getFuture

public Event getFuture(TrainerEvent trainerEvent,
                       int backOffLevel)
Description copied from class: ProbabilityStructure
Extracts the future for the specified level of back-off from the specified trainer event. Typically, futures remain the same regardless of back-off level.

Specified by:
getFuture in class ProbabilityStructure
Parameters:
trainerEvent - the event from which a future is to be extracted
backOffLevel - the back-off level for which to get the future event
Returns:
an Event object that represents the future for the specified back-off level

newModel

public Model newModel()
Description copied from class: ProbabilityStructure
Returns a newly-constructed Model object for this probability structure. The default implementation here returns an instance of Model. If a concrete ProbabilityStructure class overrides ProbabilityStructure.jointModel(), it should use this method to return an instance of a class that is suitable for handling multiple ProbabilityStructure objects, such as JointModel.

Overrides:
newModel in class ProbabilityStructure
See Also:
ProbabilityStructure.jointModel(), Model, JointModel

jointModel

public ProbabilityStructure[] jointModel()
Description copied from class: ProbabilityStructure
Returns an array of other ProbabilityStructure objects for use in a JointModel instance, or null if this probability structure should not be composed with a JointModel instance. This default implementation returns null.

Overrides:
jointModel in class ProbabilityStructure
Returns:
an array of other ProbabilityStructure objects, or null if this probability structure should not be composed with a JointModel instance
See Also:
JointModel

doCleanup

public boolean doCleanup()
Description copied from class: ProbabilityStructure
Indicates whether the Model class needs to invoke its cleanup method at the end of its deriveCounts method. The default implementation here returns false.

Overrides:
doCleanup in class ProbabilityStructure
See Also:
ProbabilityStructure.removeHistory(int,Event), ProbabilityStructure.removeFuture(int,Event), ProbabilityStructure.removeTransition(int,Transition), Model.deriveCounts(CountsTable,danbikel.util.Filter,double,danbikel.util.FlexibleMap), Model.cleanup()

removeHistory

public boolean removeHistory(int backOffLevel,
                             Event history)
In order to gather statistics for words that appear as the head of the entire sentence when estimating p(w | t), the trainer "fakes" a modifier event, as though the root node of the observed tree was seen to modify the magical +TOP+ node. We will never use the derived counts whose history contexts contain +TOP+. This method allows for the removal of these "unnecessary" counts, which will never be used when decoding.

Overrides:
removeHistory in class ProbabilityStructure
See Also:
Model.deriveCounts(CountsTable,danbikel.util.Filter,double,danbikel.util.FlexibleMap), Model.cleanup()

copy

public ProbabilityStructure copy()
Description copied from class: ProbabilityStructure
Returns a deep copy of this object. Currently, all data members of ProbabilityStructure objects are used solely as temporary storage during certain method invocations; therefore, this copy method should simply return a new instance of the runtime type of this ProbabilityStructure object, with freshly-created data members that are not deep copies of the data members of this object. The general contract of the copy method is slightly violated here, but without undue harm, given the lack of persistent data of these types of objects. If a concrete subclass has specific requirements for its data members to be deeply copied, this method should be overridden.

Specified by:
copy in class ProbabilityStructure

Parsing Engine

Author: Dan Bikel.