cc.mallet.fst
Class MaxLatticeDefault

java.lang.Object
  extended by cc.mallet.fst.MaxLatticeDefault
All Implemented Interfaces:
MaxLattice

public class MaxLatticeDefault
extends java.lang.Object
implements MaxLattice

Default, full dynamic programming version of the Viterbi "Max-(Product)-Lattice" algorithm.

Author:
Fernando Pereira, Andrew McCallum

Nested Class Summary
static class MaxLatticeDefault.Factory
           
 
Constructor Summary
MaxLatticeDefault(Transducer t, Sequence inputSequence)
           
MaxLatticeDefault(Transducer t, Sequence inputSequence, Sequence outputSequence)
           
MaxLatticeDefault(Transducer t, Sequence inputSequence, Sequence outputSequence, int maxCaches)
          Initiate Viterbi decoding of the inputSequence, contrained to match non-null parts of the outputSequence.
 
Method Summary
 SequencePairAlignment<java.lang.Object,java.lang.Object> bestOutputAlignment()
           
 java.util.List<SequencePairAlignment<java.lang.Object,java.lang.Object>> bestOutputAlignments(int n)
           
 Sequence<java.lang.Object> bestOutputSequence()
           
 java.util.List<Sequence<java.lang.Object>> bestOutputSequences(int n)
           
 SequencePairAlignment<java.lang.Object,Transducer.State> bestStateAlignment()
           
 java.util.List<SequencePairAlignment<java.lang.Object,Transducer.State>> bestStateAlignments(int n)
          Perform the backward pass of Viterbi, returning the n-best sequences of States.
 Sequence<Transducer.State> bestStateSequence()
           
 java.util.List<Sequence<Transducer.State>> bestStateSequences(int n)
           
 java.util.List<SequencePairAlignment<java.lang.Object,cc.mallet.fst.MaxLatticeDefault.ViterbiNode>> bestViterbiNodeSequences(int n)
          Perform the backward pass of Viterbi, returning the n-best sequences of ViterbiNodes.
 double bestWeight()
           
 double elementwiseAccuracy(Sequence referenceOutput)
           
 double getDelta(int ip, int stateIndex)
           
 Sequence getInput()
           
 Sequence getProvidedOutput()
           
 Transducer getTransducer()
           
protected  cc.mallet.fst.MaxLatticeDefault.ViterbiNode getViterbiNode(int ip, int stateIndex)
           
 void incrementTransducer(Transducer.Incrementor incrementor)
          Increment states and transitions with a count of 1.0 along the best state sequence.
 double tokenAccuracy(Sequence referenceOutput, java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxLatticeDefault

public MaxLatticeDefault(Transducer t,
                         Sequence inputSequence)

MaxLatticeDefault

public MaxLatticeDefault(Transducer t,
                         Sequence inputSequence,
                         Sequence outputSequence)

MaxLatticeDefault

public MaxLatticeDefault(Transducer t,
                         Sequence inputSequence,
                         Sequence outputSequence,
                         int maxCaches)
Initiate Viterbi decoding of the inputSequence, contrained to match non-null parts of the outputSequence. maxCaches indicates how much state information to memoize in n-best decoding.

Method Detail

getTransducer

public Transducer getTransducer()
Specified by:
getTransducer in interface MaxLattice

getInput

public Sequence getInput()

getProvidedOutput

public Sequence getProvidedOutput()

getViterbiNode

protected cc.mallet.fst.MaxLatticeDefault.ViterbiNode getViterbiNode(int ip,
                                                                     int stateIndex)

getDelta

public double getDelta(int ip,
                       int stateIndex)
Specified by:
getDelta in interface MaxLattice

bestViterbiNodeSequences

public java.util.List<SequencePairAlignment<java.lang.Object,cc.mallet.fst.MaxLatticeDefault.ViterbiNode>> bestViterbiNodeSequences(int n)
Perform the backward pass of Viterbi, returning the n-best sequences of ViterbiNodes. Each ViterbiNode contains the state, output symbol, and other information. Note that the length of each ViterbiNode Sequence is inputLength+1, because the first element of the sequence is the start state, and the first input/output symbols occur on the transition from a start-state to the next state. These first input/output symbols are stored in the second ViterbiNode in the sequence. The last ViterbiNode in the sequence corresponds to the final state and has the last input/output symbols.


bestStateAlignments

public java.util.List<SequencePairAlignment<java.lang.Object,Transducer.State>> bestStateAlignments(int n)
Perform the backward pass of Viterbi, returning the n-best sequences of States. Note that the length of each State Sequence is inputLength+1, because the first element of the sequence is the start state, and the first input/output symbols occur on the transition from a start state to the next state. The last State in the sequence corresponds to the final state.


bestStateAlignment

public SequencePairAlignment<java.lang.Object,Transducer.State> bestStateAlignment()

bestStateSequences

public java.util.List<Sequence<Transducer.State>> bestStateSequences(int n)
Specified by:
bestStateSequences in interface MaxLattice

bestStateSequence

public Sequence<Transducer.State> bestStateSequence()
Specified by:
bestStateSequence in interface MaxLattice

bestOutputAlignments

public java.util.List<SequencePairAlignment<java.lang.Object,java.lang.Object>> bestOutputAlignments(int n)

bestOutputAlignment

public SequencePairAlignment<java.lang.Object,java.lang.Object> bestOutputAlignment()

bestOutputSequences

public java.util.List<Sequence<java.lang.Object>> bestOutputSequences(int n)
Specified by:
bestOutputSequences in interface MaxLattice

bestOutputSequence

public Sequence<java.lang.Object> bestOutputSequence()
Specified by:
bestOutputSequence in interface MaxLattice

bestWeight

public double bestWeight()

incrementTransducer

public void incrementTransducer(Transducer.Incrementor incrementor)
Increment states and transitions with a count of 1.0 along the best state sequence. This provides for a so-called "Viterbi training" approximation.


elementwiseAccuracy

public double elementwiseAccuracy(Sequence referenceOutput)
Specified by:
elementwiseAccuracy in interface MaxLattice

tokenAccuracy

public double tokenAccuracy(Sequence referenceOutput,
                            java.io.PrintWriter out)