/** * /// Performs the recognition for the given number of frames. * * /// @param nFrames the number of frames to recognize * /// @return the current result or null if there is no Result (due to the lack of frames to recognize) */ override public Result recognize(int nFrames) { bool done = false; Result result = null; streamEnd = false; for (int i = 0; i < nFrames && !done; i++) { done = recognize(); } // generate a new temporary result if the current token is based on a final search state // remark: the first check for not null is necessary in cases that the search space does not contain scoreable tokens. if (activeList.getBestToken() != null) { // to make the current result as correct as possible we undo the last search graph expansion here ActiveList fixedList = undoLastGrowStep(); // Now create the result using the fixed active-list. if (!streamEnd) { result = new Results.Result(fixedList, resultList, currentFrameNumber, done); } } if (_showTokenCount) { showTokenCount(); } return(result); }
/** * /// Goes through the active list of tokens and expands each token, finding the set of successor tokens until all the * /// successor tokens are emitting tokens. */ protected void growBranches() { growTimer.start(); float relativeBeamThreshold = activeList.getBeamThreshold(); Trace.WriteLine("Frame: " + currentFrameNumber + " thresh : " + relativeBeamThreshold + " bs " + activeList.getBestScore() + " tok " + activeList.getBestToken()); foreach (Token token in activeList.getTokens()) { if (token.getScore() >= relativeBeamThreshold && allowExpansion(token)) { collectSuccessorTokens(token); } } growTimer.stop(); }
/** * /// Dumps out debugging info for the given active list * * /// @param al the active list to dump */ private void dumpList(ActiveList al) { Trace.WriteLine("Size: " + al.size() + " Best token: " + al.getBestToken()); }