【问题标题】:RecognizerIntent change default languageRecognizerIntent 更改默认语言
【发布时间】:2013-08-20 07:18:03
【问题描述】:

我使用以下代码启动 RecognizerIntent:

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,"us-US");
startActivityForResult(intent, RESULT_SPEECH_GUEST);

但是我的手机是用意大利语配置的,当我说“等一下”时,它会返回“uait a minut”(意大利语发音)。 为什么? 最好的问候

【问题讨论】:

    标签: java speech-recognition android-4.2-jelly-bean


    【解决方案1】:

    我解决了这个问题:

    String language =  "us-US";
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,language);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, language); 
    intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, language);
    startActivityForResult(intent, RESULT_SPEECH_GUEST);
    

    【讨论】:

    • 从 Android Oreo 开始,这是您真正需要更改的 Intent 参数:intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language); ...其余的都是矫枉过正,但无论如何,你解决了你的问题!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    • 2012-08-17
    • 2020-01-08
    • 2019-04-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多