/** * /// Returns the list of successors to this state * * * /// @return a list of SearchState objects */ protected ISearchStateArc[] GetSuccessors(Node theNode) { Node[] nodes = theNode.GetSuccessors(); //this.LogDebug("GetSuccessors(Node theNode): {0}", nodes.Length); ISearchStateArc[] arcs = new ISearchStateArc[nodes.Length]; //this.LogInfo("Arc: "+ this); int i = 0; foreach (Node nextNode in nodes) { //this.LogDebug("Next Node is of type: {0}",nextNode.GetType()); if (nextNode is WordNode) { arcs[i] = CreateWordStateArc((WordNode)nextNode, (HMMNode)GetNode(), this); } else if (nextNode is EndNode) { arcs[i] = CreateEndUnitArc((EndNode)nextNode, this); } else { arcs[i] = CreateUnitStateArc((HMMNode)nextNode, this); } i++; } return(arcs); }
public virtual ISearchStateArc[] GetSuccessors() { var result = new ISearchStateArc[1]; result[0] = new PhoneWordSearchState(unit, linguist, InsertionProbability, LanguageProbability); return(result); }
/** * /// Returns the list of successors to this state * * /// @return a list of SearchState objects */ public override ISearchStateArc[] GetSuccessors() { ISearchStateArc[] arcs = GetCachedArcs(); if (arcs == null) { HMMNode[] nodes = Parent.GetHMMNodes(GetEndNode()); arcs = new ISearchStateArc[nodes.Length]; if (Parent.GenerateUnitStates) { for (int i = 0; i < nodes.Length; i++) { arcs[i] = new LexTreeUnitState(nodes[i], WordHistory, SmearTerm, SmearProb, Parent.LogOne, Parent.LogOne, GetNode(), Parent); } } else { for (int i = 0; i < nodes.Length; i++) { IHMM hmm = nodes[i].HMM; arcs[i] = new LexTreeHmmState(nodes[i], WordHistory, SmearTerm, SmearProb, hmm.GetInitialState(), Parent.LogOne, Parent.LogOne, GetNode(), Parent); } } PutCachedArcs(arcs); } return(arcs); }
/** * /// Returns the list of successors to this state * * /// @return a list of SearchState objects */ public override ISearchStateArc[] GetSuccessors() { ISearchStateArc[] arcs = new ISearchStateArc[1]; IHMM hmm = GetHMMNode().HMM; arcs[0] = new LexTreeHmmState(GetHMMNode(), WordHistory, SmearTerm, SmearProb, hmm.GetInitialState(), _parent.LogOne, _parent.LogOne, _parentNode, _parent); return(arcs); }
/** * /// Returns the list of successors to this state * * /// @return a list of SearchState objects */ public override ISearchStateArc[] GetSuccessors() { ISearchStateArc[] arcs = GetCachedArcs(); if (arcs == null) { arcs = LexTreeLinguist.EmptyArc; WordNode wordNode = (WordNode)GetNode(); if (wordNode.GetWord() != Parent.SentenceEndWord) { int index = 0; List <Node> list = new List <Node>(); Unit[] rc = _lastNode.GetRC(); Unit left = wordNode.LastUnit; foreach (Unit unit in rc) { Node[] epList = Parent.HMMTree.GetEntryPoint(left, unit); foreach (Node n in epList) { list.Add(n); } } //this.LogDebug("NodeList: {0}",list.Count); // add a link to every possible entry point as well // as link to the </s> node arcs = new ISearchStateArc[list.Count + 1]; foreach (Node node in list) { arcs[index++] = CreateUnitStateArc((HMMNode)node, this); } // now add the link to the end of sentence arc: arcs[index++] = CreateWordStateArc(Parent.HMMTree.SentenceEndWordNode, _lastNode, this); } PutCachedArcs(arcs); } return(arcs); }
/// <summary> /// If we are final, transfer to all possible phones, otherwise return all successors of this hmm state. /// </summary> public ISearchStateArc[] GetSuccessors() { if (_state.IsExitState()) { var units = _linguist.GetUnits(((SenoneHMM)_state.HMM).SenoneSequence); var result = new ISearchStateArc[units.Count]; for (var i = 0; i < result.Length; i++) { result[i] = new PhoneNonEmittingSearchState(units[i], _linguist, InsertionProbability, LanguageProbability); } return(result); } var successors = _state.GetSuccessors(); var results = new ISearchStateArc[successors.Length]; for (var i = 0; i < successors.Length; i++) { results[i] = new PhoneHmmSearchState(successors[i].HmmState, _linguist, InsertionProbability, LanguageProbability); } return(results); }
/** * /// Retrieves the set of successors for this state * * /// @return the list of successor states */ public override ISearchStateArc[] GetSuccessors() { var nextStates = GetCachedArcs(); if (nextStates == null) { //if this is an exit state, we are transitioning to a //new unit or to a word end. if (HmmState.IsExitState()) { if (_parentNode == null) { nextStates = base.GetSuccessors(); } else { nextStates = base.GetSuccessors(_parentNode); } } else { //The current hmm state is not an exit state, so we //just go through the next set of successors var arcs = HmmState.GetSuccessors(); nextStates = new ISearchStateArc[arcs.Length]; for (var i = 0; i < arcs.Length; i++) { var arc = arcs[i]; if (arc.HmmState.IsEmitting) { //if its a self loop and the prob. matches //reuse the state if (arc.HmmState == HmmState && _logInsertionProbability == arc.LogProbability) { nextStates[i] = this; } else { nextStates[i] = new LexTreeHmmState( (HMMNode)GetNode(), WordHistory, SmearTerm, SmearProb, arc.HmmState, Parent.LogOne, arc.LogProbability, _parentNode, Parent); } } else { nextStates[i] = new LexTreeNonEmittingHMMState( (HMMNode)GetNode(), WordHistory, SmearTerm, SmearProb, arc.HmmState, arc.LogProbability, _parentNode, Parent); } } } PutCachedArcs(nextStates); } return(nextStates); }