Jet.HMM
Class HMMstate

java.lang.Object
  extended byJet.HMM.HMMstate

public class HMMstate
extends java.lang.Object

a state of a Hidden Markov Model.


Field Summary
 java.lang.String name
          the name of the state.
static double otherPreference
          a preference (log probability) to be given to states with tag 'other'.
 java.lang.String tag
          the tag of the state.
 
Constructor Summary
HMMstate(java.lang.String name, java.lang.String tag, java.lang.Class emitterClass)
           
 
Method Summary
 void addAllowedFeatureValue(java.lang.String s)
          allow tokens for which feature tokenType == s to be emitted by this state.
 void addArc(HMMarc arc)
          add arc arc to the set of arcs leaving this state.
 void addArc(java.lang.String arcName)
          add an arc to the state named arcName to the set of arcs leaving this state.
 boolean allowedToken(Annotation token)
          returns true if token token can be emitted by this state.
 void computeProbabilities()
          compute the probabilities for token emission and arc transition from the counts acquired during training.
 double getEmissionProb(java.lang.String tokenText, java.lang.String priorToken, Annotation token)
          returns the probability of emitting 'token' with attributes 'fs' when in this state.
 double getTransitionProb(int state)
          returns the probability of a transition from this state to the state numbered 'state' in the HMM.
 void incrementEmitCount(java.lang.String token, java.lang.String priorToken, int n)
          (during training), add 1 to the count of the times that 'token' is emitted by this state.
 void print()
          prints a state, along with its tag, its feature constraint (if any) its arcs, and its emission probabilities.
 void resetForTraining()
          initialize the state for training.
 void resolveNames(java.util.HashMap statesByName, int nStates)
           
 void setCacheCount(java.lang.String tag, int n)
           
 void setFeatureName(java.lang.String s)
          imposes a feature constraint on tokens which match this state.
 void setHMM(HMM hmm)
           
 void store(java.io.PrintWriter stream)
          writes a state, along with its tag, its feature constraint (if any), its arcs, and its emission probabilities, to 'stream', in a form that can be reloaded by HMM.load(java.io.Reader).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
the name of the state. This is used to refer to the state when loading, printing, and storing an HMM.


tag

public java.lang.String tag
the tag of the state. The tag is used to associate a state with a particular annotation on a document. See the description of the tag table in HMMAnnotate for further information.


otherPreference

public static double otherPreference
a preference (log probability) to be given to states with tag 'other'. A positive value increases precision at a cost in recall.

Constructor Detail

HMMstate

public HMMstate(java.lang.String name,
                java.lang.String tag,
                java.lang.Class emitterClass)
Method Detail

addArc

public void addArc(HMMarc arc)
add arc arc to the set of arcs leaving this state.


addArc

public void addArc(java.lang.String arcName)
add an arc to the state named arcName to the set of arcs leaving this state.


resolveNames

public void resolveNames(java.util.HashMap statesByName,
                         int nStates)

setHMM

public void setHMM(HMM hmm)

resetForTraining

public void resetForTraining()
initialize the state for training.


incrementEmitCount

public void incrementEmitCount(java.lang.String token,
                               java.lang.String priorToken,
                               int n)
(during training), add 1 to the count of the times that 'token' is emitted by this state.


setCacheCount

public void setCacheCount(java.lang.String tag,
                          int n)

setFeatureName

public void setFeatureName(java.lang.String s)
imposes a feature constraint on tokens which match this state. The token must have feature named 's' with a value matching one of the values specified through a call on 'allowFeatureValue'.


addAllowedFeatureValue

public void addAllowedFeatureValue(java.lang.String s)
allow tokens for which feature tokenType == s to be emitted by this state.


allowedToken

public boolean allowedToken(Annotation token)
returns true if token token can be emitted by this state. This will be true if either no feature name has been specified, , or if a feature name has been specified (through a call on setFeatureName), and that feature has one of the allowed feature values (as specified by addAllowedFeatureValue.


computeProbabilities

public void computeProbabilities()
compute the probabilities for token emission and arc transition from the counts acquired during training.


print

public void print()
prints a state, along with its tag, its feature constraint (if any) its arcs, and its emission probabilities.


store

public void store(java.io.PrintWriter stream)
writes a state, along with its tag, its feature constraint (if any), its arcs, and its emission probabilities, to 'stream', in a form that can be reloaded by HMM.load(java.io.Reader).


getEmissionProb

public double getEmissionProb(java.lang.String tokenText,
                              java.lang.String priorToken,
                              Annotation token)
returns the probability of emitting 'token' with attributes 'fs' when in this state.


getTransitionProb

public double getTransitionProb(int state)
returns the probability of a transition from this state to the state numbered 'state' in the HMM.