Package edu.cmu.sphinx.result

Examples of edu.cmu.sphinx.result.Result


    }
   
    private void processFile(String utteranceId, String inputFile) throws IOException {
        FileInputStream stream = new FileInputStream(inputFile);
        source.setInputStream(stream);
        Result result = recognizer.recognize();
        writer.println (result.getBestFinalResultNoFiller() + " (" + utteranceId + ")");
    }
View Full Code Here


            recognizer.allocate();

            for (Iterator<CTLUtterance> i = new CTLIterator(); i.hasNext();) {
                CTLUtterance utt = i.next();
                setInputStream(utt);
                Result result = recognizer.recognize();
                System.out.println("Utterance " + utteranceId + ": " + utt.getName());
                System.out.println("Reference: " + utt.getRef());
                System.out.println("Result   : " + result);
                logger.info("Utterance " + utteranceId + ": " + utt.getName());
                logger.info("Result   : " + result);
View Full Code Here

     * @param nFrames the number of frames to recognize
     * @return the current result
     */
    public Result recognize(int nFrames) {
        boolean done = false;
        Result result = null;
        streamEnd = false;

        for (int i = 0; i < nFrames && !done; i++) {
            done = recognize();
        }
       
        if (!streamEnd) {
          result = new Result(loserManager, activeList,
                                resultList, currentFrameNumber, done, linguist.getSearchGraph().getWordTokenFirst());
        }

        // tokenTypeTracker.show();
        if (showTokenCount) {
View Full Code Here

     * @return a result
     */
    @Override
    public Result decode(String referenceText) {
        searchManager.startRecognition();
        Result result;
        do {
            result = searchManager.recognize(featureBlockSize);
            if (result != null) {
                result.setReferenceText(referenceText);
                fireResultListeners(result);
            }
        } while (result != null && !result.isFinal());
        searchManager.stopRecognition();
        return result;
    }
View Full Code Here

     * @param referenceText what was actually spoken
     * @return a recognition result
     * @throws IllegalStateException if the recognizer is not in the <code>ALLOCATED</code> state
     */
    public Result recognize(String referenceText) throws IllegalStateException {
        Result result = null;
        checkState(State.READY);
        try {
            setState(State.RECOGNIZING);
            result = decoder.decode(referenceText);
        } finally {
View Full Code Here


    /** Decodes the batch of audio files */
    public void decode() throws IOException {
        List<String> resultList = new LinkedList<String>();
        Result result;
        int startReference = 0;
        hypothesisTranscript = new FileWriter(hypothesisFile);
        recognizer.allocate();
        while ((result = recognizer.recognize()) != null) {
            numUtterances++;
            String resultText = result.getBestResultNoFiller();

            System.out.println("\nHYP: " + resultText);
            System.out.println("   Sentences: " + numUtterances);
            resultList.add(resultText);

            for (WordResult wr : result.getTimedBestResult(false)) {
                hypothesisTranscript.write(wr.toString());
                hypothesisTranscript.write(' ');
            }
            hypothesisTranscript.write('\n');
            hypothesisTranscript.flush();
View Full Code Here

        /*
        * This method will return when the end of speech
        * is reached. Note that the endpointer will determine
        * the end of speech.
        */
                    Result result = recognizer.recognize();

                    if (result != null) {
                        String resultText = result.getBestResultNoFiller();
                        System.out.println("You said: " + resultText + "\n");
                    } else {
                        System.out.println("I can't hear what you said.\n");
                    }
                }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.result.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.