java - 如何使用 RecognizerIntent 强制使用土耳其语?

标签 java android voice-recognition google-voice-search

语音识别:

我使用此代码来检测:

Intent myintent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        myintent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        myintent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, lcl );

lcl 是一个变量。我选择土耳其语,它适用于土耳其语,但同时适用于英语

我不明白如果 Google 能理解每种语言,为什么我们要使用 EXTRA_LANGUAGE 参数。

I want to google force to detect turkish

可以吗

最佳答案

试试这个:

        recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "tr-TR");
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);

关于java - 如何使用 RecognizerIntent 强制使用土耳其语?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41198251/

相关文章:

java - WebView下不可点击的项目

android - NotificationCompat 无法解析为类型

android - 错误 : No view found for id androidx(Jetpack) Preference library

java - 如何在tts说话时停止语音识别?

java - 抽屉导航 Activity 从外部按钮更改 fragment

java - 在 java 中解析时出现 'illegal XML character' 问题

java - 使用 Mockito 和 Junit 时如何自动连接 spring bean?

android - 自定义偏好

android - Pocketsphinx - 完善热词检测

android - 在 Android 应用中集成 Google 语音识别