internal HypothesisUtterance(string text)
        {
            this.words = new LinkedList();
            StringTokenizer stringTokenizer = new StringTokenizer(text, " \t\n\r\f(),");

            while (stringTokenizer.hasMoreTokens())
            {
                string text2 = stringTokenizer.nextToken();
                try
                {
                    float          num            = Float.parseFloat(stringTokenizer.nextToken());
                    float          num2           = Float.parseFloat(stringTokenizer.nextToken());
                    HypothesisWord hypothesisWord = new HypothesisWord(text2, num, num2);
                    this.words.add(hypothesisWord);
                }
                catch (NumberFormatException ex)
                {
                    Throwable.instancehelper_printStackTrace(ex);
                }
                continue;
            }
            if (!this.words.isEmpty())
            {
                HypothesisWord hypothesisWord2 = (HypothesisWord)this.words.get(0);
                this.startTime = hypothesisWord2.getStartTime();
                HypothesisWord hypothesisWord3 = (HypothesisWord)this.words.get(this.words.size() - 1);
                this.endTime = hypothesisWord3.getEndTime();
            }
        }
Ejemplo n.º 2
0
        public virtual int detect()
        {
            int num  = 0;
            int num2 = 0;
            ReferenceUtterance referenceUtterance = this.referenceFile.nextUtterance();
            StringBuilder      stringBuilder      = new StringBuilder();

            while (num2 == 0)
            {
                HypothesisWord hypothesisWord = this.hypothesisFile.nextWord();
                if (hypothesisWord != null)
                {
                    int num3 = 0;
                    while (referenceUtterance != null && referenceUtterance.getEndTime() < hypothesisWord.getStartTime())
                    {
                        referenceUtterance = this.referenceFile.nextUtterance();
                    }
                    if (referenceUtterance != null)
                    {
                        if (referenceUtterance.isSilenceGap())
                        {
                            num3 = 1;
                        }
                        else
                        {
                            while (referenceUtterance.getEndTime() < hypothesisWord.getEndTime())
                            {
                                referenceUtterance = this.referenceFile.nextUtterance();
                                if (referenceUtterance == null || referenceUtterance.isSilenceGap())
                                {
                                    num3 = 1;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        num3 = 1;
                    }
                    if (num3 != 0)
                    {
                        num++;
                        if (this.showGapInsertions)
                        {
                            stringBuilder.append("GapInsError: Utterance: ").append(this.hypothesisFile.getUtteranceCount()).append(" Word: ").append(hypothesisWord.getText()).append(" (").append(hypothesisWord.getStartTime()).append(',').append(hypothesisWord.getEndTime()).append("). ");
                            if (referenceUtterance != null)
                            {
                                if (!GapInsertionDetector.assertionsDisabled && !referenceUtterance.isSilenceGap())
                                {
                                    throw new AssertionError();
                                }
                                stringBuilder.append("Reference: <sil> (").append(referenceUtterance.getStartTime()).append(',').append(referenceUtterance.getEndTime()).append(')');
                            }
                            stringBuilder.append('\n');
                        }
                    }
                }
                else
                {
                    num2 = 1;
                }
            }
            if (this.showGapInsertions)
            {
                [email protected](stringBuilder);
            }
            return(num);
        }