乌尔都语到乌尔都语,使用SpeechRecognizer和RecognitionListener

时间:2019-07-16 14:43:00

标签: java android

我正在研究urdu到urdu语音识别。但是我所得到的只是罗马乌尔都语。

private void startListening() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

    intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, "Urdu");
    final SpeechRecognizer recognizer = SpeechRecognizer
            .createSpeechRecognizer(this.getApplicationContext());
    RecognitionListener listener = new RecognitionListener() {
        @Override
        public void onResults(Bundle results) {
            ArrayList<String> voiceResults = results
                    .getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);

            if (voiceResults != null) {
                tv_output2.setText(voiceResults.get(0));
            }
            if (voiceResults == null) {
                System.out.println("No voice results");
            } else {
                System.out.println("Printing matches: ");
                for (String match : voiceResults) {
                    System.out.println(match);
                }
            }
        }


    };
    recognizer.setRecognitionListener(listener);
    recognizer.startListening(intent);

我得到的响应是“ tum kaisa hoa”,而不是“تمکیسیہو”

0 个答案:

没有答案