Пример #1
0
        internal StateRecord(TransitionRecord transition, EmissionRecord emission, StateRecord previousState)
        {
            transition.CheckWhetherArgumentIsNull("transition");
            emission.CheckWhetherArgumentIsNull("emission");

            this.transition    = transition;
            this.emission      = emission;
            this.previousState = previousState;
            this.nextStates    = new HashSet <StateRecord> ();

            this.logProbability = this.transition.LogProbability + this.emission.LogProbability;
        }
        internal StateRecord(TransitionRecord transition, EmissionRecord emission, StateRecord previousState)
        {
            transition.CheckWhetherArgumentIsNull ("transition");
            emission.CheckWhetherArgumentIsNull ("emission");

            this.transition = transition;
            this.emission = emission;
            this.previousState = previousState;
            this.nextStates = new HashSet<StateRecord> ();

            this.logProbability = this.transition.LogProbability + this.emission.LogProbability;
        }
Пример #3
0
        private IEnumerable <StateRecord> CreateNonRootStateRecords(TransitionRecord transition, EmissionRecord emission, bool isRoot)
        {
            var fromTransition = transition.FromTransition;

            if (isRoot)
            {
                yield return(new StateRecord(transition, emission, null));

                yield break;
            }

            var previousStateRecords = this.stateRecordWorkspace.Where(stateRecord => stateRecord.Transition.ToTransition == fromTransition);

            foreach (var previousStateRecord in previousStateRecords)
            {
                var newStateRecord = new StateRecord(transition, emission, previousStateRecord);
                previousStateRecord.AddNextState(newStateRecord);
                yield return(newStateRecord);
            }
        }