private void expandPronunciation(UnitContext unitContext, Pronunciation pronunciation, int which) { UnitContext startingContext = this.getStartingContext(pronunciation); string name = new StringBuilder().append("P(").append(pronunciation.getWord()).append('[').append(unitContext).append(',').append(startingContext).append("])-G").append(this.getNode().getID()).toString(); PronunciationState pronunciationState = new PronunciationState(name, pronunciation, which); FlatLinguist.access_100(this.this_0, new StringBuilder().append(" Expanding ").append(pronunciationState.getPronunciation()).append(" for lc ").append(unitContext).toString()); ContextPair contextPair = ContextPair.get(unitContext, startingContext); List list = (List)this.entryPoints.get(contextPair); if (list == null) { string text = new StringBuilder().append("No EP list for context pair ").append(contextPair).toString(); throw new Error(text); } list.add(pronunciationState); Unit[] units = pronunciation.getUnits(); int num = units.Length - this.getRightContextSize(); if (num < 0) { num = 0; } SentenceHMMState sentenceHMMState = pronunciationState; int num2 = 0; while (sentenceHMMState != null && num2 < num) { sentenceHMMState = this.attachUnit(pronunciationState, sentenceHMMState, units, num2, unitContext, UnitContext.EMPTY); num2++; } SentenceHMMState sentenceHMMState2 = sentenceHMMState; Iterator iterator = this.rightContexts.iterator(); while (iterator.hasNext()) { UnitContext unitContext2 = (UnitContext)iterator.next(); sentenceHMMState = sentenceHMMState2; int num3 = num; while (sentenceHMMState != null && num3 < units.Length) { sentenceHMMState = this.attachUnit(pronunciationState, sentenceHMMState, units, num3, unitContext, unitContext2); num3++; } } }
private SentenceHMMState attachUnit(PronunciationState parent, SentenceHMMState sentenceHMMState, Unit[] array, int num, UnitContext unitContext, UnitContext unitContext2) { Unit[] lc = this.getLC(unitContext, array, num); Unit[] rc = this.getRC(array, num, unitContext2); UnitContext unitContext3 = UnitContext.get(rc); LeftRightContext context = LeftRightContext.get(lc, rc); Unit unit = FlatLinguist.access_200(this.this_0).getUnit(array[num].getName(), array[num].isFiller(), context); ExtendedUnitState extendedUnitState = new ExtendedUnitState(parent, num, unit); float logInsertionProbablity; if (extendedUnitState.getUnit().isSilence()) { logInsertionProbablity = FlatLinguist.access_300(this.this_0); } else if (extendedUnitState.getUnit().isFiller()) { logInsertionProbablity = FlatLinguist.access_400(this.this_0); } else if (extendedUnitState.getWhich() == 0) { logInsertionProbablity = FlatLinguist.access_500(this.this_0); } else { logInsertionProbablity = FlatLinguist.access_600(this.this_0); } SentenceHMMState existingState = this.getExistingState(extendedUnitState); if (existingState != null) { this.attachState(sentenceHMMState, existingState, 0f, logInsertionProbablity); return(null); } this.attachState(sentenceHMMState, extendedUnitState, 0f, logInsertionProbablity); this.addStateToCache(extendedUnitState); sentenceHMMState = this.expandUnit(extendedUnitState); if (extendedUnitState.isLast()) { UnitContext unitContext4 = this.generateNextLeftContext(unitContext, array[num]); ContextPair contextPair = ContextPair.get(unitContext4, unitContext3); this.addExitPoint(contextPair, sentenceHMMState); } return(sentenceHMMState); }
public UnitState(PronunciationState parent, int which, Unit unit) : base("U", parent, which) { this.position = HMMPosition.__INTERNAL; this.unit = unit; Unit[] units = parent.getPronunciation().getUnits(); int num = units.Length; if (units[num - 1] == UnitManager.__SILENCE && num > 1) { num--; } if (num == 1) { this.position = HMMPosition.__SINGLE; } else if (which == 0) { this.position = HMMPosition.__BEGIN; } else if (which == num - 1) { this.position = HMMPosition.__END; } }
public GrammarPoint(PronunciationState state, int which) : this(state) { this.unitIndex = which; }
public ExtendedUnitState(PronunciationState parent, int which, Unit unit) : base(parent, which, unit) { }