private void BeginningStep() { for (int I = 0; I < m_WorkingStates.Count; I++) Results[0, I] = new ViterbiResult( 0, m_BeginingState.Name, m_BeginingState.Name, 1); }
private void MakeStep(int Pos, HMM State, int ArrayStateIndex) { double PrevMaxStateValue = 0; string PrevStateName = ""; for (int I = 0; I < m_WorkingStates.Count; I++) { HMM PrevState = (Pos == 1) ? m_BeginingState : m_WorkingStates[I]; double PrevStateValue = Results[Pos - 1, I].Possibility * PrevState.GetTransitionStrength(State.Name); if (PrevStateValue > PrevMaxStateValue) { PrevMaxStateValue = PrevStateValue; PrevStateName = PrevState.Name; } } double Emission = (Pos == m_Sequence.Count + 1) ? 1 : State.GetEmmisionStrength(m_Sequence[Pos - 1].Sequence); Results[Pos, ArrayStateIndex] = new ViterbiResult( Pos, State.Name, PrevStateName, Emission * PrevMaxStateValue); }