/// <summary>
        /// Calculate the acoustic scores for the active list. The active list should contain only emitting tokens.
        /// </summary>
        /// <returns><code>true</code> if there are more frames to score, otherwise, false</returns>
        protected bool ScoreTokens()
        {
            ScoreTimer.Start();
            var data = Scorer.CalculateScores(ActiveList.GetTokens());

            this.LogDebug("Scored Data: {0}", data);
            ScoreTimer.Stop();

            Token bestToken = null;

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

            var moreTokens = (bestToken != null);

            ActiveList.SetBestToken(bestToken);

            //monitorWords(activeList);
            MonitorStates(ActiveList);

            this.LogDebug("bestToken: {0}", bestToken);

            CurTokensScored.Value   += ActiveList.Size;
            TotalTokensScored.Value += ActiveList.Size;

            return(moreTokens);
        }
Beispiel #2
0
        /// <summary>
        /// Calculate the acoustic scores for the active list. The active list should contain only emitting tokens.
        /// </summary>
        /// <returns><code>true</code> if there are more frames to score, otherwise, false</returns>
        protected bool ScoreTokens()
        {
            var hasMoreFrames = false;

            _scoreTimer.Start();
            this.LogDebug("Calculating score for an activelist of Size: {0}", ActiveList.Count());
            var data = _scorer.CalculateScores(ActiveList.GetTokens());

            this.LogDebug("Score Data: {0}", data);
            _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);
        }