internal SenoneHMMState(SenoneHMM senoneHMM, int num) { this.hmm = senoneHMM; this.state = num; this._isEmitting = (senoneHMM.getTransitionMatrix().Length - 1 != this.state); if (this._isEmitting) { SenoneSequence senoneSequence = senoneHMM.getSenoneSequence(); this.senone = senoneSequence.getSenones()[this.state]; } Utilities.objectTracker("HMMState", SenoneHMMState.objectCount++); this._hashCode = senoneHMM.hashCode() + 37 * this.state; }
public virtual SenoneSequence getCompositeSenoneSequence(Unit unit, HMMPosition position) { string text = unit.toString(); SenoneSequence senoneSequence = (SenoneSequence)this.compositeSenoneSequenceCache.get(text); if (this.logger.isLoggable(Level.FINE)) { this.logger.fine((new StringBuilder().append("getCompositeSenoneSequence: ").append(unit).append(senoneSequence).toString() != null) ? "Cached" : ""); } if (senoneSequence != null) { return(senoneSequence); } Context context = unit.getContext(); ArrayList arrayList = new ArrayList(); Iterator hmmiterator = this.getHMMIterator(); while (hmmiterator.hasNext()) { SenoneHMM senoneHMM = (SenoneHMM)hmmiterator.next(); if (senoneHMM.getPosition() == position) { Unit unit2 = senoneHMM.getUnit(); if (unit2.isPartialMatch(unit.getName(), context)) { if (this.logger.isLoggable(Level.FINE)) { this.logger.fine(new StringBuilder().append("collected: ").append(senoneHMM.getUnit()).toString()); } arrayList.add(senoneHMM.getSenoneSequence()); } } } if (arrayList.isEmpty()) { Unit unit3 = this.unitManager.getUnit(unit.getName(), unit.isFiller()); SenoneHMM senoneHMM = this.lookupHMM(unit3, HMMPosition.__UNDEFINED); arrayList.add(senoneHMM.getSenoneSequence()); } int num = 0; Iterator iterator = arrayList.iterator(); while (iterator.hasNext()) { SenoneSequence senoneSequence2 = (SenoneSequence)iterator.next(); if (senoneSequence2.getSenones().Length > num) { num = senoneSequence2.getSenones().Length; } } ArrayList arrayList2 = new ArrayList(); float weight = 0f; for (int i = 0; i < num; i++) { HashSet hashSet = new HashSet(); Iterator iterator2 = arrayList.iterator(); while (iterator2.hasNext()) { SenoneSequence senoneSequence3 = (SenoneSequence)iterator2.next(); if (i < senoneSequence3.getSenones().Length) { Senone senone = senoneSequence3.getSenones()[i]; hashSet.add(senone); } } arrayList2.add(CompositeSenone.create(hashSet, weight)); } senoneSequence = SenoneSequence.create(arrayList2); this.compositeSenoneSequenceCache.put(unit.toString(), senoneSequence); if (this.logger.isLoggable(Level.FINE)) { this.logger.fine(new StringBuilder().append(unit).append(" consists of ").append(arrayList2.size()).append(" composite senones").toString()); if (this.logger.isLoggable(Level.FINEST)) { senoneSequence.dump("am"); } } return(senoneSequence); }