我可以保持语音识别听下去? [英] Can I keep the speech recognizer listening indefinitely?

查看:285
本文介绍了我可以保持语音识别听下去?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我称之为 SpeechRecognizer 对象的 startListening 法,语音识别开始监听讲话。我想创建一个等待一个特定关键字的语音服务:当用户说,这个关键字的语音识别器检测到这个关键字,那么该服务准备好接收用户的语音命令

When I call the startListening method of a SpeechRecognizer object, the speech recognizer starts listening for speech. I would like to create a service that is waiting for speech of a specific keyword: when the user says this keyword and the speech recognizer detects this keyword, then the service becomes ready to receive user voice commands.

为此,新的 SpeechRecognizer 实例化,我应该叫其 startListening 方法后:我可以保持语音识别听下去?

To this end, after a new SpeechRecognizer instantiated, I should call its startListening method: can I keep the speech recognizer listening indefinitely?

推荐答案

Android的语音识别可以通过意向额外的数据定制。请参阅<一href="http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS">the Android的文档。

The Android Speech recognizer can be customized through the intent extra data. See the android documentation.

公共静态最后弦乐    EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS

public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS

的时候,应该考虑后,我们停止听到讲话的金额   考虑输入完整的。 [...]

The amount of time that it should take after we stop hearing speech to consider the input complete. [...]

公共静态最后弦乐 EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS   自:API级别8

public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS Since: API Level 8

话语的最小长度。之前,我们不会停止录像   此时间。 [...]

The minimum length of an utterance. We will not stop recording before this amount of time. [...]

公共静态最后弦乐 EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

的时候,应该考虑后,我们停止听到讲话的金额   考虑输入可能是完整的。 [...]

The amount of time that it should take after we stop hearing speech to consider the input possibly complete. [...]

将<一href="http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_LANGUAGE_MODEL">EXTRA_LANGUAGE_MODEL以网络搜索只采集相关的话。

Set the EXTRA_LANGUAGE_MODEL to websearch to capture only relevant words.

这篇关于我可以保持语音识别听下去?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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