コード例 #1
0
 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());
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
 protected internal virtual void handleResult(DataOutputStream @out, BatchNISTRecognizer.CTLUtterance utt, Result result)
 {
     this.dumpBestPath(@out, utt, result.getBestFinalToken());
 }
コード例 #6
0
 public virtual BatchNISTRecognizer.CTLUtterance next()
 {
     BatchNISTRecognizer.CTLUtterance result = this.utterance;
     this.utterance = this.nextUtterance();
     return(result);
 }
コード例 #7
0
 protected internal override void setInputStream(BatchNISTRecognizer.CTLUtterance utt)
 {
     base.setInputStream(utt);
     this.bfaGrammar.setUtterance(utt.getName());
 }