Example #1
0
        /**
         * /// 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()
        {
            int mapSize = activeList.size() * 10;

            if (mapSize == 0)
            {
                mapSize = 1;
            }
            growTimer.start();
            bestTokenMap = new Dictionary <ISearchState, Token>(mapSize);
            ActiveList oldActiveList = activeList;

            resultList    = new List <Token>();
            activeList    = activeListFactory.newInstance();
            threshold     = oldActiveList.getBeamThreshold();
            wordThreshold = oldActiveList.getBestScore() + logRelativeWordBeamWidth;

            foreach (Token token in oldActiveList.getTokens())
            {
                collectSuccessorTokens(token);
            }
            growTimer.stop();

            #if Debug
            int hmms = activeList.size();
            totalHmms += hmms;
            Trace.WriteLine("Frame: " + currentFrameNumber + " Hmms: "
                            + hmms + "  total " + totalHmms);
                #endif
        }
Example #2
0
        /**
         * /// 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();
        }
Example #3
0
        /**
         * /// Because the growBranches() is called although no data is left after the last speech frame, the ordering of the
         * /// active-list might depend on the transition probabilities and (penalty-scores) only. Therefore we need to undo the last
         * /// grow-step up to final states or the last emitting state in order to fix the list.
         * /// @return newly created list
         */
        protected ActiveList undoLastGrowStep()
        {
            var fixedList = activeList.newInstance();

            foreach (var token in activeList.getTokens())
            {
                var curToken = token.getPredecessor();

                // remove the final states that are not the real final ones because they're just hide prior final tokens:
                while (curToken.getPredecessor() != null && (
                           (curToken.isFinal() && curToken.getPredecessor() != null && !curToken.getPredecessor().isFinal()) ||
                           (curToken.isEmitting() && curToken.getData() == null) ||      // the so long not scored tokens
                           (!curToken.isFinal() && !curToken.isEmitting())))
                {
                    curToken = curToken.getPredecessor();
                }

                fixedList.add(curToken);
            }

            return(fixedList);
        }