Пример #1
0
        /// <summary>
        ///Returns the best scoring token in the active set
        ///
        ///@return the best scoring token or null
        /// <summary>
        public Token getBestActiveToken()
        {
            Token bestToken = null;

            if (activeList != null)
            {
                foreach (Token token in activeList.getTokens())
                {
                    if (bestToken == null ||
                        token.getScore() > bestToken.getScore())
                    {
                        bestToken = token;
                    }
                }
            }
            return(bestToken);
        }
Пример #2
0
        /**
         * Calculate the acoustic scores for the active list. The active list should
         * contain only emitting tokens.
         *
         * @return <code>true</code> if there are more frames to score, otherwise,
         *         false
         */
        protected bool scoreTokens()
        {
            bool hasMoreFrames = false;

            scoreTimer.start();
            Data data = scorer.calculateScores(activeList.getTokens());

            scoreTimer.stop();

            Token bestToken = null;

            if (data is Token)
            {
                bestToken = (Token)data;
            }
            else if (data == null)
            {
                streamEnd = true;
            }

            if (bestToken != null)
            {
                hasMoreFrames = true;
                activeList.setBestToken(bestToken);
            }

            // update statistics
            curTokensScored.value   += activeList.size();
            totalTokensScored.value += activeList.size();
            tokensPerSecond.value    = totalTokensScored.value / getTotalTime();

            // if (logger.isLoggable(Level.FINE)) {
            // logger.fine(currentFrameNumber + " " + activeList.size()
            // + " " + curTokensScored.value + " "
            // + (int) tokensPerSecond.value);
            // }

            return(hasMoreFrames);
        }