SpeechRecognizer与谷歌搜索的版本3.6.14.1337016不能识别其他声音语言的默认,除了 [英] SpeechRecognizer with Google Search version 3.6.14.1337016 can't recognize other voice language except default

查看:161
本文介绍了SpeechRecognizer与谷歌搜索的版本3.6.14.1337016不能识别其他声音语言的默认,除了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在最新的谷歌搜索的设置中设置了很多语音语言。 但问题是,SpeechRecognizer只能识别默认语言。

You can set many voice languages on the setting of latest Google search. But the problem is that SpeechRecognizer can recognize only the default language.

我实现了...

private SpeechRecognizer mGoogleRecognizer; 

private void startRecognition() {
    mGoogleRecognizer = SpeechRecognizer.createSpeechRecognizer(m_context);
    mGoogleRecognizer.setRecognitionListener(this);
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "ko-KR");
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Intellectual Personal Assistant");
    intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, m_context.getPackageName());
    mGoogleRecognizer.startListening(intent);
}

@Override
public void onResults(Bundle results) {
    ArrayList<String> resultList = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
}

我请求确认有关朝鲜,但resultList包括默认语言只是结果。

I request the recognition about Korean but the resultList includes only results of default language.

我怎样才能得到正确的结果呢?

How can I get right result?

感谢。

推荐答案

尽管这是不记录任何地方,我已经能够找出,引进在其最后一次更新多语言支持,谷歌搜索是现在采取新的额外的RecognizerIntent称为android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES。所建议的名称,它是一个字符串数组,将用于指定除其他语言的主要的一个,而这仍通过RecognizerIntent.EXTRA_LANGUAGE给出。现在的问题是,谷歌搜索会忽略RecognizerIntent.EXTRA_LANGUAGE如果这个新的额外的不与它一起给予。这意味着,将下面一行添加到您的code就足以解决问题:

Even though this is not documented anywhere, I've been able to find out that, with the introduction of multilanguage support in its last update, Google Search is now taking a new extra in RecognizerIntent called "android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES". As suggested by its name, it is a string array that would be used to specify other languages in addition to the main one, which would still be given by RecognizerIntent.EXTRA_LANGUAGE. The problem is that Google Search ignores RecognizerIntent.EXTRA_LANGUAGE if this new extra is not given along with it. This means that adding the following line to your code is enough to solve the problem:

intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String[]{});

但请注意,尽管这部作品,它不会改变的事实,那就是在谷歌搜索中的错误。正如我以前说过的,这个新的额外的不记录任何地方,和谷歌搜索不继Android的语音识别API规范。由于这两个谷歌搜索和Android开发者,谷歌因此应该可以:

But please note that, even though this works, it doesn't change the fact that there is a bug in Google Search. As I've said before, this new extra is not documented anywhere, and Google Search is not following the specification of Android's speech recognition API. As the developer of both Google Search and Android, Google should therefore either:

  1. 更​​改Android的语音识别API的规范, 但这样会破坏向后兼容性。

  1. Change the specification of the speech recognition API in Android, but this would break backward compatibility.

更​​新谷歌搜索应用程序以便其正确跟随 当前规范。

Update the Google Search app so that it correctly follows the current specification.

第二个选项显然是最合乎逻辑的,因此,我们应该让谷歌知道的错误,让他们修复它。它看起来像谷歌官方搜索帮助论坛是正确的地方要做到这一点,但至今没有人从谷歌一直关注我在那里创建了它的线程(<一href="https://productforums.google.com/forum/#!topic/websearch/PUjEPmdSzSE/discussion">https://productforums.google.com/forum/#!topic/websearch/PUjEPmdSzSE/discussion).所以,如果你有过这样的问题,请发表您的抱怨也抓住谷歌的注意力,让我们看看,如果我们得到正式答复这个样子。

The second option is obviously the most logical one, and we should therefore let Google know about the bug so that they fix it. It looks like the official Google Search Help Forum is the right place to do this, but so far nobody from Google has paid attention to the thread I created there for it (https://productforums.google.com/forum/#!topic/websearch/PUjEPmdSzSE/discussion). So if you have had this issue please post your complains there to grab Google's attention, and let's see if we get an official answer this way.

这篇关于SpeechRecognizer与谷歌搜索的版本3.6.14.1337016不能识别其他声音语言的默认,除了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆