0

I am trying Google speech API with the sample app and it returns below JSON: results { alternatives { transcript: "\350\251\246\345\232\207\345\273\243\346\235\261\350\251\261\350\250\273\345\206\212\346\231\202\351\226\223" confidence: 0.8150804 } }

I used it to recognise some Cantonese, but i don't understand what is going on with the transcript. Can somebody let me know how do I decode the above transcript back to Chinese characters? Thanks.

  • I just find that those print-out are standard out things from GRPC's generated client. I get the Chinese characters when I use GRPC's client to get the transcript. – user2168008 Nov 27 '16 at 05:15

1 Answers1

0

Following the example's instructions and you will see the response on standard out. And in Eclipse you will see some classes are missing. You can find the java files of those classes in ./target/generated-sources/protobuf . Adding the folders into it to classpath. And modify the example to get the "AsyncRecognizeResponse" (in case you are using AsyncClient). And to get the alternatives correctly just simply using the API of the generated client:

        List<SpeechRecognitionResult> rresult = result.getResultsList();

    for(SpeechRecognitionResult srr:rresult){
        SpeechRecognitionAlternative alternativesStr = srr.getAlternatives(0);
        String transcriptStr= alternativesStr.getTranscript();
        System.out.println(transcriptStr);
    }

Actually it was so easy, just remember you are using GRPC and give a few try.