我正在研究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”,而不是“تمکیسیہو”