private void createContextDependentSuccessors()
        {
            this.cdHMMs             = new HashMap();
            this.senonesToUnits     = new HashMap();
            this.fillerHMMs         = new ArrayList();
            this.leftContextSilHMMs = new ArrayList();
            Iterator hmmiterator = this.acousticModel.getHMMIterator();

            while (hmmiterator.hasNext())
            {
                HMM            hmm            = (HMM)hmmiterator.next();
                SenoneSequence senoneSequence = ((SenoneHMM)hmm).getSenoneSequence();
                ArrayList      arrayList;
                if ((arrayList = (ArrayList)this.senonesToUnits.get(senoneSequence)) == null)
                {
                    arrayList = new ArrayList();
                    this.senonesToUnits.put(senoneSequence, arrayList);
                }
                arrayList.add(hmm.getUnit());
                if (hmm.getUnit().isFiller())
                {
                    this.fillerHMMs.add(hmm);
                }
                else if (hmm.getUnit().isContextDependent())
                {
                    LeftRightContext leftRightContext = (LeftRightContext)hmm.getUnit().getContext();
                    Unit             unit             = leftRightContext.getLeftContext()[0];
                    if (unit == UnitManager.__SILENCE)
                    {
                        this.leftContextSilHMMs.add(hmm);
                    }
                    else
                    {
                        Unit    baseUnit = hmm.getUnit().getBaseUnit();
                        HashMap hashMap;
                        if ((hashMap = (HashMap)this.cdHMMs.get(unit)) == null)
                        {
                            hashMap = new HashMap();
                            this.cdHMMs.put(unit, hashMap);
                        }
                        ArrayList arrayList2;
                        if ((arrayList2 = (ArrayList)hashMap.get(baseUnit)) == null)
                        {
                            arrayList2 = new ArrayList();
                            hashMap.put(baseUnit, arrayList2);
                        }
                        arrayList2.add(hmm);
                    }
                }
            }
            this.leftContextSilHMMs.addAll(this.fillerHMMs);
        }
        private void createContextIndependentSuccessors()
        {
            Iterator hmmiterator = this.acousticModel.getHMMIterator();

            this.ciHMMs         = new ArrayList();
            this.senonesToUnits = new HashMap();
            while (hmmiterator.hasNext())
            {
                HMM hmm = (HMM)hmmiterator.next();
                if (!hmm.getUnit().isContextDependent())
                {
                    SenoneSequence senoneSequence = ((SenoneHMM)hmm).getSenoneSequence();
                    ArrayList      arrayList;
                    if ((arrayList = (ArrayList)this.senonesToUnits.get(senoneSequence)) == null)
                    {
                        arrayList = new ArrayList();
                        this.senonesToUnits.put(senoneSequence, arrayList);
                    }
                    arrayList.add(hmm.getUnit());
                    this.ciHMMs.add(hmm);
                }
            }
        }
Exemplo n.º 3
0
 public virtual void put(HMM hmm)
 {
     ((Map)this.hmmsPerPosition.get(hmm.getPosition())).put(hmm.getUnit(), hmm);
     this.allHMMs.add(hmm);
 }
Exemplo n.º 4
0
        public HMMPool(AcousticModel model, Logger logger, UnitManager unitManager)
        {
            this.logger = logger;
            int num = 0;

            this.model       = model;
            this.unitManager = unitManager;
            if (model.getLeftContextSize() != 1)
            {
                string text = "LexTreeLinguist: Unsupported left context size";

                throw new Error(text);
            }
            if (model.getRightContextSize() != 1)
            {
                string text2 = "LexTreeLinguist: Unsupported right context size";

                throw new Error(text2);
            }
            Iterator iterator = model.getContextIndependentUnitIterator();

            while (iterator.hasNext())
            {
                Unit unit = (Unit)iterator.next();
                logger.fine(new StringBuilder().append("CI unit ").append(unit).toString());
                if (unit.getBaseID() > num)
                {
                    num = unit.getBaseID();
                }
            }
            this.numCIUnits = num + 1;
            this.unitTable  = new Unit[this.numCIUnits * this.numCIUnits * this.numCIUnits];
            iterator        = model.getHMMIterator();
            while (iterator.hasNext())
            {
                HMM  hmm   = (HMM)iterator.next();
                Unit unit2 = hmm.getUnit();
                int  id    = this.getID(unit2);
                this.unitTable[id] = unit2;
                if (logger.isLoggable(Level.FINER))
                {
                    logger.finer(new StringBuilder().append("Unit ").append(unit2).append(" id ").append(id).toString());
                }
            }
            this.hmmTable = new EnumMap(ClassLiteral <HMMPosition> .Value);
            HMMPosition[] array = HMMPosition.values();
            int           num2  = array.Length;

            for (int i = 0; i < num2; i++)
            {
                HMMPosition hmmposition = array[i];
                HMM[]       array2      = new HMM[this.unitTable.Length];
                this.hmmTable.put(hmmposition, array2);
                for (int j = 1; j < this.unitTable.Length; j++)
                {
                    Unit unit3 = this.unitTable[j];
                    if (unit3 == null)
                    {
                        unit3 = this.synthesizeUnit(j);
                    }
                    if (unit3 != null)
                    {
                        array2[j] = model.lookupNearestHMM(unit3, hmmposition, false);
                        if (!HMMPool.assertionsDisabled && array2[j] == null)
                        {
                            throw new AssertionError();
                        }
                    }
                }
            }
        }