Exemple #1
0
 public GrammarPoint(SentenceHMMState state)
 {
     while (state != null)
     {
         if (state is UnitState)
         {
             this.unitIndex = state.getWhich();
         }
         else if (state is PronunciationState)
         {
             this.pronunciationIndex = state.getWhich();
         }
         else if (state is WordState)
         {
             this.wordIndex = state.getWhich();
         }
         else if (state is AlternativeState)
         {
             this.alternativeIndex = state.getWhich();
         }
         else if (state is GrammarState)
         {
             this.node = ((GrammarState)state).getGrammarNode();
         }
         state = state.getParent();
     }
     if (!GrammarPoint.assertionsDisabled && this.node == null)
     {
         throw new AssertionError();
     }
 }
        public virtual Word getAssociatedWord()
        {
            Word             result           = null;
            SentenceHMMState sentenceHMMState = this;

            while (sentenceHMMState != null && !(sentenceHMMState is WordState))
            {
                sentenceHMMState = sentenceHMMState.getParent();
            }
            if (sentenceHMMState != null)
            {
                WordState wordState = (WordState)sentenceHMMState;
                result = wordState.getWord();
            }
            return(result);
        }