Exemple #1
0
            public PhoneLoopSearchGraph(CIPhoneLoop this_0)
            {
                this.this_0           = this_0;
                this.__existingStates = new HashMap();
                this.__firstState     = new UnknownWordState();
                BranchOutState branchOutState = new BranchOutState(this.__firstState);

                this.attachState(this.__firstState, branchOutState, 0f, 0f);
                LoopBackState loopBackState = new LoopBackState(this.__firstState);

                loopBackState.setFinalState(true);
                this.attachState(loopBackState, branchOutState, 0f, 0f);
                Iterator contextIndependentUnitIterator = this_0.__model.getContextIndependentUnitIterator();

                while (contextIndependentUnitIterator.hasNext())
                {
                    UnitState unitState = new UnitState((Unit)contextIndependentUnitIterator.next(), HMMPosition.__UNDEFINED);
                    this.attachState(branchOutState, unitState, 0f, CIPhoneLoop.access_000(this_0));
                    HMM           hmm           = this_0.__model.lookupNearestHMM(unitState.getUnit(), unitState.getPosition(), false);
                    HMMState      initialState  = hmm.getInitialState();
                    HMMStateState hmmstateState = new HMMStateState(unitState, initialState);
                    this.addStateToCache(hmmstateState);
                    this.attachState(unitState, hmmstateState, 0f, 0f);
                    HMMStateState prevState = this.expandHMMTree(unitState, hmmstateState);
                    this.attachState(prevState, loopBackState, 0f, 0f);
                }
            }
Exemple #2
0
 internal static float access_000(CIPhoneLoop ciphoneLoop)
 {
     return(ciphoneLoop.logPhoneInsertionProbability);
 }
Exemple #3
0
        protected internal virtual Collection compileGrammar()
        {
            this.initialGrammarState = this.grammar.getInitialNode();
            this.nodeStateMap        = new HashMap();
            this.arcPool             = new Cache();
            ArrayList arrayList = new ArrayList();

            TimerPool.getTimer(this, "Compile").start();
            TimerPool.getTimer(this, "Create States").start();
            Iterator iterator = this.grammar.getGrammarNodes().iterator();

            while (iterator.hasNext())
            {
                GrammarNode         grammarNode = (GrammarNode)iterator.next();
                FlatLinguist.GState gstate      = this.createGState(grammarNode);
                arrayList.add(gstate);
            }
            TimerPool.getTimer(this, "Create States").stop();
            this.addStartingPath();
            TimerPool.getTimer(this, "Collect Contexts").start();
            iterator = arrayList.iterator();
            while (iterator.hasNext())
            {
                FlatLinguist.GState gstate2 = (FlatLinguist.GState)iterator.next();
                gstate2.collectContexts();
            }
            TimerPool.getTimer(this, "Collect Contexts").stop();
            TimerPool.getTimer(this, "Expand States").start();
            iterator = arrayList.iterator();
            while (iterator.hasNext())
            {
                FlatLinguist.GState gstate2 = (FlatLinguist.GState)iterator.next();
                gstate2.expand();
            }
            TimerPool.getTimer(this, "Expand States").stop();
            TimerPool.getTimer(this, "Connect Nodes").start();
            iterator = arrayList.iterator();
            while (iterator.hasNext())
            {
                FlatLinguist.GState gstate2 = (FlatLinguist.GState)iterator.next();
                gstate2.connect();
            }
            TimerPool.getTimer(this, "Connect Nodes").stop();
            SentenceHMMState sentenceHMMState = this.findStartingState();

            if (this.addOutOfGrammarBranch)
            {
                CIPhoneLoop      ciphoneLoop = new CIPhoneLoop(this.phoneLoopAcousticModel, this.logPhoneInsertionProbability);
                SentenceHMMState nextState   = (SentenceHMMState)ciphoneLoop.getSearchGraph().getInitialState();
                sentenceHMMState.connect(this.getArc(nextState, 0f, this.logOutOfGrammarBranchProbability));
            }
            this.searchGraph = new FlatLinguist.FlatSearchGraph(this, sentenceHMMState);
            TimerPool.getTimer(this, "Compile").stop();
            if (this.dumpGStates)
            {
                Iterator iterator2 = this.grammar.getGrammarNodes().iterator();
                while (iterator2.hasNext())
                {
                    GrammarNode         node    = (GrammarNode)iterator2.next();
                    FlatLinguist.GState gstate3 = this.getGState(node);
                    gstate3.dumpInfo();
                }
            }
            this.nodeStateMap = null;
            this.arcPool      = null;
            return(SentenceHMMState.collectStates(sentenceHMMState));
        }