public virtual void connect() { GrammarArc[] successors = this.getSuccessors(); int num = successors.Length; for (int i = 0; i < num; i++) { GrammarArc grammarArc = successors[i]; FlatLinguist.GState gstate = this.this_0.getGState(grammarArc.getGrammarNode()); if (gstate.getNode().isEmpty() || !String.instancehelper_equals(gstate.getNode().getWord().getSpelling(), "<s>")) { float num2 = grammarArc.getProbability(); if (FlatLinguist.access_800(this.this_0) && !gstate.getNode().isEmpty()) { int num3 = gstate.getNode().getWord().getPronunciations().Length; num2 -= this.this_0.logMath.linearToLog((double)num3); } float num4 = num2; Iterator iterator = this.exitPoints.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); List list = gstate.getEntryPoints((ContextPair)entry.getKey()); if (list != null) { List list2 = (List)entry.getValue(); this.connect(list2, list, num4); } } } } }
internal static int access_1008(FlatLinguist flatLinguist) { int num = flatLinguist.totalStateCounter; int result = num; flatLinguist.totalStateCounter = num + 1; return(result); }
protected internal virtual SentenceHMMState expandUnit(UnitState unit) { HMMStateState hmmstates = this.getHMMStates(unit); if (unit.getUnit().isSilence()) { this.attachState(hmmstates, unit, 0f, FlatLinguist.access_300(this.this_0)); } return(hmmstates); }
protected internal GState(FlatLinguist this_0, GrammarNode node) { this.this_0 = this_0; this.entryPoints = new HashMap(); this.exitPoints = new HashMap(); this.existingStates = new HashMap(); this.rightContexts = new HashSet(); this.leftContexts = new HashSet(); this.node = node; this_0.nodeStateMap.put(node, this); }
private void expandWord(UnitContext unitContext) { Word word = this.node.getWord(); FlatLinguist.access_100(this.this_0, new StringBuilder().append(" Expanding word ").append(word).append(" for lc ").append(unitContext).toString()); Pronunciation[] pronunciations = word.getPronunciations(); for (int i = 0; i < pronunciations.Length; i++) { this.expandPronunciation(unitContext, pronunciations[i], i); } }
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)); }
protected internal virtual void attachState(SentenceHMMState prevState, SentenceHMMState nextState, float logLanguageProbablity, float logInsertionProbablity) { prevState.connect(this.this_0.getArc(nextState, logLanguageProbablity, logInsertionProbablity)); if (FlatLinguist.access_900(this.this_0)) { bool flag = FlatLinguist.access_1008(this.this_0) != 0; int num = 1000; if (num == -1 || (flag ? 1 : 0) % num == 0) { [email protected]("."); } } }
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); }
internal static bool access_800(FlatLinguist flatLinguist) { return(flatLinguist.spreadWordProbabilitiesAcrossPronunciations); }
internal static UnitManager access_200(FlatLinguist flatLinguist) { return(flatLinguist.unitManager); }
internal static void access_100(FlatLinguist flatLinguist, string text) { flatLinguist.T(text); }
internal static float access_300(FlatLinguist flatLinguist) { return(flatLinguist.logSilenceInsertionProbability); }
protected internal virtual int getLeftContextSize() { return(FlatLinguist.access_700(this.this_0).getLeftContextSize()); }
internal static float access_400(FlatLinguist flatLinguist) { return(flatLinguist.logFillerInsertionProbability); }
public FlatSearchGraph(FlatLinguist this_0, SearchState initialState) { this.this_0 = this_0; this.initialState = initialState; }
internal static float access_600(FlatLinguist flatLinguist) { return(flatLinguist.logUnitInsertionProbability); }
internal static bool access_900(FlatLinguist flatLinguist) { return(flatLinguist.showCompilationProgress); }
internal static AcousticModel access_700(FlatLinguist flatLinguist) { return(flatLinguist.acousticModel); }