app/src/main/java/edu/cmu/pocketsphinx/demo/PocketSphinxActivity.java
@Override
    public void onPartialResult(Hypothesis hypothesis) {
        if (hypothesis == null)
            return;

        String text = hypothesis.getHypstr();
        ((TextView) findViewById(R.id.result_text)).setText(text);

        Log.d("STUFF", "onPartialResult: " + text);
        if (text.equals(KEYPHRASE))
            switchSearch(NAMES_SEARCH);
        else if (text.equals("mike ")
                || text.equals("rick")
                || text.equals("bingo")) {
            NAME = text;
            switchSearch(COMMAND_SEARCH);
        } else if (text.equals("forward ")
                || text.equals("backward ")
                || text.equals("left ")
                || text.equals("right ")
                || text.equals("land ")
                || text.equals("stop ")
                || text.equals("takeoff ")
                || text.equals("heal ")) {
            COMMAND = text;
            switchSearch(DUR_SEARCH);
        } else if (text.equals("one ")
                || text.equals("two ")
                || text.equals("three ")) {
            DUR = text;
            switchSearch(KWS_SEARCH);
        } else {
            NAME = null;
            COMMAND = null;
            DUR = null;
            switchSearch(KWS_SEARCH);
        }
    }
/**
     * In partial result we get quick updates about current hypothesis. In
     * keyword spotting mode we can react here, in other modes we need to wait
     * for final result in onResult.
     */
In partial result we get quick updates about current hypothesis. In
keyword spotting mode we can react here, in other modes we need to wait
for final result in onResult.
In partial result we get quick updates about current hypothesis . In keyword spotting mode we can react here in other modes we need to wait for final result in onResult .
@Override
    public void onPartialResult(Hypothesis hypothesis) {
        if (hypothesis == null)
            return;
        String text = hypothesis.getHypstr();
        ((TextView) findViewById(R.id.result_text)).setText(text);
        Log.d("STUFF", "onPartialResult: " + text);
        if (text.equals(KEYPHRASE))
            switchSearch(NAMES_SEARCH);
        else if (text.equals("mike ")
                || text.equals("rick")
                || text.equals("bingo")) {
            NAME = text;
            switchSearch(COMMAND_SEARCH);
        } else if (text.equals("forward ")
                || text.equals("backward ")
                || text.equals("left ")
                || text.equals("right ")
                || text.equals("land ")
                || text.equals("stop ")
                || text.equals("takeoff ")
                || text.equals("heal ")) {
            COMMAND = text;
            switchSearch(DUR_SEARCH);
        } else if (text.equals("one ")
                || text.equals("two ")
                || text.equals("three ")) {
            DUR = text;
            switchSearch(KWS_SEARCH);
        } else {
            NAME = null;
            COMMAND = null;
            DUR = null;
            switchSearch(KWS_SEARCH);
        }
    }
@ Override public void onPartialResult ( Hypothesis hypothesis ) { if ( hypothesis == null ) return ; String text = hypothesis . getHypstr ( ) ; ( ( TextView ) findViewById ( R . id . result_text ) ) . setText ( text ) ; Log . d ( "STUFF" , "onPartialResult: " + text ) ; if ( text . equals ( KEYPHRASE ) ) switchSearch ( NAMES_SEARCH ) ; else if ( text . equals ( "mike " ) || text . equals ( "rick" ) || text . equals ( "bingo" ) ) { NAME = text ; switchSearch ( COMMAND_SEARCH ) ; } else if ( text . equals ( "forward " ) || text . equals ( "backward " ) || text . equals ( "left " ) || text . equals ( "right " ) || text . equals ( "land " ) || text . equals ( "stop " ) || text . equals ( "takeoff " ) || text . equals ( "heal " ) ) { COMMAND = text ; switchSearch ( DUR_SEARCH ) ; } else if ( text . equals ( "one " ) || text . equals ( "two " ) || text . equals ( "three " ) ) { DUR = text ; switchSearch ( KWS_SEARCH ) ; } else { NAME = null ; COMMAND = null ; DUR = null ; switchSearch ( KWS_SEARCH ) ; } }
In partial result we get quick updates about current hypothesis.
In partial result we get quick updates about current hypothesis .