Sautrela

edu.gtts.sautrela.wfsa.models
Class TreeModel

java.lang.Object
  extended by edu.gtts.sautrela.wfsa.models.TreeModel
All Implemented Interfaces:
NdWFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>, WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>

public class TreeModel
extends java.lang.Object
implements NdWFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>

Author:
mpenagar

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.gtts.sautrela.wfsa.WFSA
WFSA.Factory
 
Field Summary
static WFSA.Factory myFactory
           
 
Method Summary
 void dumpTrainCounts()
          Dumps the trained data to the model.
 Alphabet<Symbol> getAlphabet()
          Returns the alphabet of the Model.
 double getFinProb(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state)
          Returns the probability of being final
 edu.gtts.sautrela.wfsa.models.TreeModel.State_ getIniState()
          Returns the initial State
 java.lang.String getName()
          Returns the name of the Model.
 edu.gtts.sautrela.wfsa.models.TreeModel.Transition_ getRandomTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state)
          Returns a random transitions from a state
 edu.gtts.sautrela.wfsa.models.TreeModel.Transition_[] getTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ from)
          Returns all possible transitions from a state.
 edu.gtts.sautrela.wfsa.models.TreeModel.Transition_[] getTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ from, Symbol symbol)
          Returns all possible transitions for the given source state and symbol.
 void incrementTrainCount(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state, double count)
          Increments the training counts associated to a final state.
 void incrementTrainCount(edu.gtts.sautrela.wfsa.models.TreeModel.Transition_ t, double count)
          Increments the training counts associated to a Transition.
 void initTrainCounts(double initCount)
          Initializes the training counts.
static void main(java.lang.String[] args)
           
 java.lang.String toXML()
          Returns a XML representation of the WFSA
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myFactory

public static final WFSA.Factory myFactory
Method Detail

getName

public java.lang.String getName()
Description copied from interface: WFSA
Returns the name of the Model.

Specified by:
getName in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Returns:
The name of the Model

getAlphabet

public Alphabet<Symbol> getAlphabet()
Description copied from interface: WFSA
Returns the alphabet of the Model.

Specified by:
getAlphabet in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Returns:
The Alphabet

getIniState

public edu.gtts.sautrela.wfsa.models.TreeModel.State_ getIniState()
Description copied from interface: WFSA
Returns the initial State

Specified by:
getIniState in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Returns:
The initial state

getFinProb

public double getFinProb(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state)
Description copied from interface: WFSA
Returns the probability of being final

Specified by:
getFinProb in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Returns:
The probability of being final

getTrans

public edu.gtts.sautrela.wfsa.models.TreeModel.Transition_[] getTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ from)
                                                               throws java.lang.UnsupportedOperationException
Description copied from interface: WFSA
Returns all possible transitions from a state.

Specified by:
getTrans in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
from - The source State
Returns:
an array containing all possible transitions from a state. If there is no transition, and empty array must be returned.
Throws:
java.lang.UnsupportedOperationException

getRandomTrans

public edu.gtts.sautrela.wfsa.models.TreeModel.Transition_ getRandomTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state)
Description copied from interface: WFSA
Returns a random transitions from a state

Specified by:
getRandomTrans in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
state - The source State
Returns:
a random transition

getTrans

public edu.gtts.sautrela.wfsa.models.TreeModel.Transition_[] getTrans(edu.gtts.sautrela.wfsa.models.TreeModel.State_ from,
                                                                      Symbol symbol)
Description copied from interface: NdWFSA
Returns all possible transitions for the given source state and symbol. The array should be ordered in descending probability (the most probable transition is the first and the less probable is the last).

Specified by:
getTrans in interface NdWFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
from - the source State
symbol - the observed symbol
Returns:
an array containing all possible transitions. If there is no transition, an empty array must be returned.

initTrainCounts

public void initTrainCounts(double initCount)
Description copied from interface: WFSA
Initializes the training counts. Al previous counts are cleared and initCount is used as initial posterior probability count of the WFSA (MAP training). This count must be distributed among all the internal parameters according to their prior probabilities.

Specified by:
initTrainCounts in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
initCount - initial posterior probability count

incrementTrainCount

public void incrementTrainCount(edu.gtts.sautrela.wfsa.models.TreeModel.State_ state,
                                double count)
Description copied from interface: WFSA
Increments the training counts associated to a final state. These counts are related to the final probability of a State.

Specified by:
incrementTrainCount in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
state - the final Sate
count - the training count.

incrementTrainCount

public void incrementTrainCount(edu.gtts.sautrela.wfsa.models.TreeModel.Transition_ t,
                                double count)
Description copied from interface: WFSA
Increments the training counts associated to a Transition. These counts are related to the probability of a Transition.

Specified by:
incrementTrainCount in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>
Parameters:
t - the Transition
count - the training count.

dumpTrainCounts

public void dumpTrainCounts()
Description copied from interface: WFSA
Dumps the trained data to the model.

Specified by:
dumpTrainCounts in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>

toXML

public java.lang.String toXML()
Description copied from interface: WFSA
Returns a XML representation of the WFSA

Specified by:
toXML in interface WFSA<edu.gtts.sautrela.wfsa.models.TreeModel.State_,Symbol,edu.gtts.sautrela.wfsa.models.TreeModel.Transition_>

main

public static void main(java.lang.String[] args)

Sautrela