public virtual void decode()
 {
     try
     {
         this.utteranceId = 0;
         DataOutputStream @out = new DataOutputStream(new FileOutputStream(this.ctmFile));
         this.recognizer.allocate();
         BatchNISTRecognizer.CTLIterator ctliterator = new BatchNISTRecognizer.CTLIterator(this);
         while (ctliterator.hasNext())
         {
             BatchNISTRecognizer.CTLUtterance ctlutterance = (BatchNISTRecognizer.CTLUtterance)ctliterator.next();
             this.setInputStream(ctlutterance);
             Result result = this.recognizer.recognize();
             [email protected](new StringBuilder().append("Utterance ").append(this.utteranceId).append(": ").append(ctlutterance.getName()).toString());
             [email protected](new StringBuilder().append("Reference: ").append(ctlutterance.getRef()).toString());
             [email protected](new StringBuilder().append("Result   : ").append(result).toString());
             this.logger.info(new StringBuilder().append("Utterance ").append(this.utteranceId).append(": ").append(ctlutterance.getName()).toString());
             this.logger.info(new StringBuilder().append("Result   : ").append(result).toString());
             this.handleResult(@out, ctlutterance, result);
             this.utteranceId++;
         }
         this.recognizer.deallocate();
     }
     catch (IOException ex)
     {
         this.logger.severe(new StringBuilder().append("I/O error during decoding: ").append(Throwable.instancehelper_getMessage(ex)).toString());
     }
     this.logger.info(new StringBuilder().append("BatchCTLDecoder: ").append(this.utteranceId).append(" utterances decoded").toString());
 }
        private long dumpBestPath(DataOutputStream dataOutputStream, BatchNISTRecognizer.CTLUtterance ctlutterance, Token token)
        {
            if (token == null)
            {
                return(0L);
            }
            Token predecessor = token.getPredecessor();
            long  num         = this.dumpBestPath(dataOutputStream, ctlutterance, predecessor);

            if (token.isWord())
            {
                long            collectTime     = token.getCollectTime();
                WordSearchState wordSearchState = (WordSearchState)token.getSearchState();
                Word            word            = wordSearchState.getPronunciation().getWord();
                string          spelling        = word.getSpelling();
                if (!String.instancehelper_startsWith(spelling, "<"))
                {
                    string[] array = String.instancehelper_split(ctlutterance.name, "_");
                    dataOutputStream.write(String.instancehelper_getBytes(new StringBuilder().append(array[0]).append('_').append(array[1]).append('_').append(array[2]).append(" 1 ").append((double)((long)ctlutterance.startOffset + num) / 100.0).append(' ').append((double)(collectTime - num) / 100.0).append(' ').toString()));
                    dataOutputStream.write(BatchNISTRecognizer.hex2Binary(spelling));
                    dataOutputStream.write(String.instancehelper_getBytes(" 0.700000\n"));
                }
                return(collectTime);
            }
            return(num);
        }
        protected internal override void handleResult(DataOutputStream @out, BatchNISTRecognizer.CTLUtterance utt, Result result)
        {
            [email protected](new StringBuilder().append(utt).append(" --> ").append(result).toString());
            Token bestToken = result.getBestToken();

            this.dumpTokenTimes(bestToken);
        }
        protected internal virtual void setInputStream(BatchNISTRecognizer.CTLUtterance utt)
        {
            Iterator iterator = this.inputDataProcessors.iterator();

            while (iterator.hasNext())
            {
                DataProcessor dataProcessor = (DataProcessor)iterator.next();
                if (dataProcessor is StreamDataSource)
                {
                    ((StreamDataSource)dataProcessor).setInputStream(utt.getInputStream());
                }
                else if (dataProcessor is StreamCepstrumSource)
                {
                    int bigEndian = Utilities.isCepstraFileBigEndian(utt.getName()) ? 1 : 0;
                    StreamCepstrumSource streamCepstrumSource = (StreamCepstrumSource)dataProcessor;
                    streamCepstrumSource.setInputStream(utt.getInputStream(), bigEndian != 0);
                }
            }
        }
 protected internal virtual void handleResult(DataOutputStream @out, BatchNISTRecognizer.CTLUtterance utt, Result result)
 {
     this.dumpBestPath(@out, utt, result.getBestFinalToken());
 }
 public virtual BatchNISTRecognizer.CTLUtterance next()
 {
     BatchNISTRecognizer.CTLUtterance result = this.utterance;
     this.utterance = this.nextUtterance();
     return(result);
 }
 protected internal override void setInputStream(BatchNISTRecognizer.CTLUtterance utt)
 {
     base.setInputStream(utt);
     this.bfaGrammar.setUtterance(utt.getName());
 }