コード例 #1
0
        protected internal override void collectSuccessorTokens(Token token)
        {
            if (token.isFinal())
            {
                this.resultList.add(this.getResultListPredecessor(token));
                return;
            }
            if (!token.isEmitting() && this.keepAllTokens && this.isVisited(token))
            {
                return;
            }
            SearchState searchState = token.getSearchState();

            SearchStateArc[] successors            = searchState.getSuccessors();
            Token            resultListPredecessor = this.getResultListPredecessor(token);
            float            score         = token.getScore();
            float            beamThreshold = this.activeList.getBeamThreshold();
            int num = (!(searchState is LexTreeLinguist.LexTreeNonEmittingHMMState) && !(searchState is LexTreeLinguist.LexTreeWordState) && !(searchState is LexTreeLinguist.LexTreeEndUnitState)) ? 0 : 1;

            SearchStateArc[] array = successors;
            int num2 = array.Length;
            int i    = 0;

            while (i < num2)
            {
                SearchStateArc searchStateArc = array[i];
                SearchState    state          = searchStateArc.getState();
                if (num == 0 || !(state is LexTreeLinguist.LexTreeHMMState))
                {
                    goto IL_110;
                }
                int   baseID = ((LexTreeLinguist.LexTreeHMMState)state).getHMMState().getHMM().getBaseUnit().getBaseID();
                Float @float = ((Float)this.penalties.get(Integer.valueOf(baseID))) ?? this.updateLookaheadPenalty(baseID);
                if (score + this.lookaheadWeight * @float.floatValue() >= beamThreshold)
                {
                    goto IL_110;
                }
IL_207:
                i++;
                continue;
IL_110:
                if (this._checkStateOrder)
                {
                    this.checkStateOrder(searchState, state);
                }
                float num3      = score + searchStateArc.getProbability();
                Token bestToken = this.getBestToken(state);
                if (bestToken == null)
                {
                    Token token2 = new Token(resultListPredecessor, state, num3, searchStateArc.getInsertionProbability(), searchStateArc.getLanguageProbability(), this.currentCollectTime);
                    StatisticsVariable tokensCreated = this.tokensCreated;
                    tokensCreated.value += (double)1f;
                    this.setBestToken(token2, state);
                    this.activeListAdd(token2);
                    goto IL_207;
                }
                if (bestToken.getScore() < num3)
                {
                    Token token2 = bestToken.getPredecessor();
                    bestToken.update(resultListPredecessor, state, num3, searchStateArc.getInsertionProbability(), searchStateArc.getLanguageProbability(), this.currentCollectTime);
                    if (this.buildWordLattice && state is WordSearchState)
                    {
                        this.loserManager.addAlternatePredecessor(bestToken, token2);
                    }
                    goto IL_207;
                }
                if (this.buildWordLattice && state is WordSearchState && resultListPredecessor != null)
                {
                    this.loserManager.addAlternatePredecessor(bestToken, resultListPredecessor);
                    goto IL_207;
                }
                goto IL_207;
            }
        }
コード例 #2
0
 protected internal virtual void setFastMatchBestToken(Token token, SearchState state)
 {
     this.fastMatchBestTokenMap.put(state, token);
 }