Ejemplo n.º 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
        }
Ejemplo n.º 2
0
        /**
         * /// creates a new best token map with the best size
         */
        protected void createBestTokenMap()
        {
            int mapSize = activeList.size() * 10;

            if (mapSize == 0)
            {
                mapSize = 1;
            }
            bestTokenMap = new Dictionary <Object, Token>(mapSize);
            foreach (KeyValuePair <Object, Token> iter in bestTokenMap)
            {
                iter.Value.setScore(0.3f);
            }
        }
Ejemplo n.º 3
0
        /** Removes unpromising branches from the active list */
        protected void pruneBranches()
        {
            int startSize = activeList.size();

            pruneTimer.start();
            activeList        = pruner.prune(activeList);
            beamPruned.value += startSize - activeList.size();
            pruneTimer.stop();
        }
Ejemplo n.º 4
0
        /**
         * /// Keeps track of and reports statistics about the number of active states
         *
         * /// @param activeList the active list of states
         */
        private void monitorStates(ActiveList activeList)
        {
            tokenSum += activeList.size();
            tokenCount++;

            if ((tokenCount % 1000) == 0)
            {
                Trace.WriteLine("Average Tokens/State: " + (tokenSum / tokenCount));
            }
        }
Ejemplo n.º 5
0
 /**
  * /// 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());
 }