Package cc.mallet.fst

Class 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
    • Constructor Detail

      • 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

      • 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.
      • 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()
      • 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.
      • tokenAccuracy

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