谷歌玻璃和语音识别的时间延迟确认结果 [英] Google Glass and Speech Recognizer time delay recognizing results

查看:1551
本文介绍了谷歌玻璃和语音识别的时间延迟确认结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个玻璃的应用程序,将通过语音执行忘词和previous卡。该应用程序工作得很好,除了从当一句话也没说何时执行该操作是刚刚超过1秒的时间。这是一个足够长的时间延迟,这是明显的。这不尽快谷歌已经用OK玻璃回应。

I am working on a Glass application that will perform "Next Card" and "Previous Card" via speech. The application works just fine, except the time from when the word is spoken to when the action is performed is just over 1 second. This is a long enough delay that it is noticeable. This does not respond as quickly as Google has it with "ok glass".

最明显的变化似乎是实现: EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS 和/或EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS 和/或EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

The most obvious change seems to be to implement: EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS and/or EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS and/or EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

但目前还没有效果。人们还注意到在Android的RecognizerIntent网页对这些所有的3: 还要注意,某些值可能会导致意外或意外的结果 - !用明智另外,根据识别器实现,这些值可能没有任何效果

but this currently has no effect. It is also noted on Android's RecognizerIntent webpage for all 3 of these: "Note also that certain values may cause undesired or unexpected results - use judiciously! Additionally, depending on the recognizer implementation, these values may have no effect."

下面是code,如何这是主要实现:

Here is the code as to how this is implemented in main:

        speechIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    speechIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getApplication().getPackageName());
    speechIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
    speechIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, Long.valueOf(100));
    speechIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, Long.valueOf(100));
    speechIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, Long.valueOf(100));

    speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
    speechRecognizer.setRecognitionListener(this);

    if (SpeechRecognizer.isRecognitionAvailable(this)) {
        speechRecognizer.startListening(speechIntent);

        }

我试图用新龙(),并同时更换Long.valueOf()仅100(我也尝试了500的价值,如果由于某种原因,100只是小)。使用Long.valueOf()。Eclipse的警告建议

I have tried to replace Long.valueOf() with new Long() and also just 100 (I also tried the value of 500 if for some reason 100 is just to small). Eclipse's warning recommended using Long.valueOf().

结果回来就onPartialResults,这个过程中更好地工作,然后onResults因为onResults等待一个暂停。由于测试上面的3群众演员,我有结果回来onResults,但没有改变。

The results are coming back on onPartialResults, this process works better then onResults since onResults waits for a pause. Because of testing the 3 extras above, I had the results coming back onResults, but there was no change.

这是我在这里缺少什么任何想法?如果您需要查看更多code,让我知道。 谢谢你。

Any ideas on what I am missing here? If you need to see more code, let me know. Thank you.

推荐答案

对于这样简单的命令,你应该使用的上下文语音菜单而不是语音识别争取更好的成绩。

For brief commands like this, you should use a contextual voice menu instead of the speech recognizer for better results.

您可以看到目前批准的命令的列表<一href="https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/ContextualMenus.Command"相对=nofollow>此处,但发展你可以使用任何你想要的命令(通过将开发许可,以您的清单)中。

You can see a list of currently approved commands here, but during development you can use whatever commands you want (by adding the development permission to your manifest).

请务必同时提交任何新的语音命令,你可能需要,如果你想经历在今后的审查过程和启动。

Make sure to also submit any new voice commands that you might need if you would like to go through the review process and launch in the future.

这篇关于谷歌玻璃和语音识别的时间延迟确认结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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