Daff - Data Diff

daff.Viterbi

Do a Viterbi lattice calculation to calculate the optimum state to be in at each step of a sequence, given the costs of transitions between those states at each step.

Type: class

Constructor:

new()

Methods:

addTransition (s0 : Int, s1 : Int, c : Float) : Void
  For the current step in the sequence, we assert that
  transitioning from state `s0` to state `s1` would cost `c`.
beginTransitions () : Void
  Begin one individual step in the sequence.
  After this, we call `addTransition` for every possible state
  transition, and then `endTransitions`.
  Then we repeat the cycle for the next step in the sequence,
  or call `calculatePath`.
calculatePath () : Void
  Compute the best state sequence.
endTransitions () : Void
  Declare that we are finished asserting possible state transitions
  for the current step in the sequence.  After this, we either
  call `beginTransitions` again for the next step, or call
  `calculatePath`.
get (i : Int) : Int

Parameters: the step in the sequence

Returns: the optimal state for that step

getCost () : Float

Returns: the total cost of the optimal state sequence

length () : Int

Returns: the length of the optimal state sequence

reset () : Void
  Reset the state to its initial value.
setSize (states : Int, sequence_length : Int) : Void
  Configure the maximum number of states and the maximum sequence
  length that we care about.

Parameters:

  • states maximum number of states
  • sequence_length maximum sequence length
toString () : String

Returns: the optimal state sequence as a string