/** * /// Connects the arc to this sentence hmm, but don't affect the predecessor relation ship * * /// @param arc the arc to the next state */ private void RawConnect(SentenceHMMStateArc arc) { var state = (SentenceHMMState)arc.State; // attach the state-number because the state-signature is not necessarily unique arcs.Put(state.GetValueSignature() + state.StateNumber, arc); }
protected void AttachState(SentenceHMMState prevState, SentenceHMMState nextState, float logLanguageProbability, float logInsertionProbability) { var arc = new SentenceHMMStateArc (nextState, logLanguageProbability, logInsertionProbability); prevState.Connect(arc); }
/** * /// Connects the arc to this sentence hmm. If the node at the end of the arc is already pointing to some other node * /// as its predecessor, don't change that relationship, since its probably a result of the nodes being reused' * * /// @param arc the path to the next state */ public void Connect(SentenceHMMStateArc arc) { if (successorArray != null) { successorArray = null; } RawConnect(arc); }
/** * /// Gets a SentenceHMMStateArc. The arc is drawn from a pool of arcs. * * /// @param nextState the next state * /// @param logLanguageProbability the log language probability * /// @param logInsertionProbability the log insertion probability */ protected SentenceHMMStateArc GetArc(SentenceHMMState nextState, float logLanguageProbability, float logInsertionProbability) { var arc = new SentenceHMMStateArc(nextState, logLanguageProbability * _languageWeight, logInsertionProbability); var pooledArc = ArcPool.cache(arc); ActualArcs.Value = ArcPool.Misses; TotalArcs.Value = ArcPool.Hits + ArcPool.Misses; return(pooledArc == null ? arc : pooledArc); }
/** * /// remove the given arc from the set of succors * * /// @param arc the arc to remove */ void DeleteSuccessor(SentenceHMMStateArc arc) { arcs.Remove(arc); }