Ejemplo n.º 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);
                }
            }
Ejemplo n.º 2
0
            private HMMStateState getHMMStates(UnitState unitState)
            {
                Unit          unit          = unitState.getUnit();
                HMMPosition   position      = unitState.getPosition();
                HMM           hmm           = FlatLinguist.access_700(this.this_0).lookupNearestHMM(unit, position, false);
                HMMState      initialState  = hmm.getInitialState();
                HMMStateState hmmstateState = new HMMStateState(unitState, initialState);

                this.attachState(unitState, hmmstateState, 0f, 0f);
                this.addStateToCache(hmmstateState);
                return(this.expandHMMTree(unitState, hmmstateState));
            }
Ejemplo n.º 3
0
        /** Constructs a phone loop search graph. */
        public PhoneLoopSearchGraph(SentenceHMMState initState, AcousticModel model, float logPhoneInsertionProbability)
        {
            this.inititalState = initState;
            this.model         = model;
            this.logPhoneInsertionProbability = logPhoneInsertionProbability;
            existingStates = new Dictionary <string, SearchState>();
            firstState     = new UnknownWordState();
            SentenceHMMState branchState = new BranchOutState(firstState);

            attachState(firstState, branchState, logOne, logOne);

            SentenceHMMState lastState = new LoopBackState(firstState);

            //lastState.setFinalState(true);
            //attachState(lastState, branchState, LogMath.getLogZero(),
            //		LogMath.getLogZero());
            attachState(lastState, inititalState, logOne, logOne);

            for (java.util.Iterator i = model.getContextIndependentUnitIterator(); i.hasNext();)
            {
                Unit      unit      = (Unit)i.next();
                UnitState unitState = new UnitState(unit, HMMPosition.UNDEFINED);

                // attach unit state to the branch out state
                attachState(branchState, unitState, logOne, logPhoneInsertionProbability);

                HMM hmm = model.lookupNearestHMM
                              (unitState.getUnit(), unitState.getPosition(), false);
                HMMState      initialState = hmm.getInitialState();
                HMMStateState hmmTree      = new HMMStateState(unitState, initialState);
                addStateToCache(hmmTree);

                // attach first HMM state to the unit state
                attachState(unitState, hmmTree, logOne, logOne);

                // expand the HMM tree
                HMMStateState finalState = expandHMMTree(unitState, hmmTree);

                // attach final state of HMM tree to the loopback state
                attachState(finalState, lastState, logOne, logOne);
            }
        }
        public override SearchStateArc[] getSuccessors()
        {
            ArrayList arrayList = new ArrayList();
            Unit      @base     = UnitManager.__SILENCE;
            Unit      baseUnit  = this.unit.getBaseUnit();

            if (this.unit.isContextDependent())
            {
                @base = ((LeftRightContext)this.unit.getContext()).getRightContext()[0];
            }
            ArrayList arrayList2 = (!this.linguist.useContextDependentPhones()) ? this.linguist.getCISuccessors() : this.linguist.getCDSuccessors(baseUnit, @base);
            Iterator  iterator   = arrayList2.iterator();

            while (iterator.hasNext())
            {
                HMM hmm = (HMM)iterator.next();
                arrayList.add(new PhoneHmmSearchState(hmm.getInitialState(), this.linguist, this.linguist.getPhoneInsertionProb(), 0f));
            }
            return((SearchStateArc[])arrayList.toArray(new SearchStateArc[arrayList.size()]));
        }