public abstract class AbstractHmmEstimator extends AbstractHmm implements ObjectHandler<Tagging<String>>, Compilable
HmmEstimator may be used to train a hidden Markov
model (HMM). Training events are supplied through the ObjectHandler interface method handle(Tagging). The estimator implements an
HMM, so is suitable for use in a tag-a-little, learn-a-little
environment or elswhere when an adaptive HMM is required.
At any point, the estimator may be compiled to an object output
stream using compileTo(ObjectOutput).| Constructor and Description |
|---|
AbstractHmmEstimator(SymbolTable table)
Construct an HMM estimator with the specified tag symbol table.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
compileTo(ObjectOutput objOut)
Compiles a copy of this estimated HMM to the specified object
output.
|
void |
handle(Tagging<String> tagging)
Train the estimator with the specified tokens, whitespaces and
states.
|
long |
numTrainingCases()
Return the number of taggings handled.
|
long |
numTrainingTokens()
Returns the number of tokens handled for training.
|
abstract void |
trainEmit(String state,
CharSequence emission)
Train the emission estimator with the specified training
instance consisting of a state and emission.
|
abstract void |
trainEnd(String state)
Train the end state estimator with the specified end state.
|
abstract void |
trainStart(String state)
Train the start state estimator with the specified start state.
|
abstract void |
trainTransit(String sourceState,
String targetState)
Trains the transition estimator from the specified transition
from the specified source state to the specified target state.
|
addState, emitLog2Prob, emitLog2Prob, emitProb, emitProb, endLog2Prob, endLog2Prob, endProb, endProb, startLog2Prob, startLog2Prob, startProb, startProb, stateSymbolTable, transitLog2Prob, transitLog2Prob, transitProb, transitProbpublic AbstractHmmEstimator(SymbolTable table)
table - Symbol table for tags.public abstract void trainStart(String state)
state - State being trained.public abstract void trainEnd(String state)
state - State being trained.public abstract void trainTransit(String sourceState, String targetState)
sourceState - State from which the transition is made.targetState - State to which the transition is made.public abstract void trainEmit(String state, CharSequence emission)
state - State being trained.emission - Emission from state being trained.public abstract void compileTo(ObjectOutput objOut) throws IOException
HiddenMarkovModel, but will
most likely not be an instance of the same class as the object
being compiled.compileTo in interface CompilableobjOut - Object output to which this estimator is
compiled.IOException - If there is an I/O exception compiling this
object.public long numTrainingCases()
handle(Tagging) has been called.public long numTrainingTokens()
handle(Tagging) method.public void handle(Tagging<String> tagging)
For a specified tagging made up of parallel sequences of tags and tokens, this method calls:
trainTransit(String,String)
on each tag pair,
trainEmit(String,CharSequence) on
each tag/token pair,
trainStart(String) on the first tag, and
trainEnd(String) on the last tag.
handle in interface ObjectHandler<Tagging<String>>tagging - Tagging from which tokens and tags are derived.Copyright © 2016 Alias-i, Inc.. All rights reserved.