public class ASREngine
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ASREngine.Callback |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
static int |
TIMEOUT_ASR |
Modifier | Constructor and Description |
---|---|
protected |
ASREngine() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
取消此次识别
|
protected void |
destroy() |
boolean |
disableVad()
设置取消VAD检测接口
|
boolean |
enableVad()
设置使用VAD检测接口
|
static ASREngine |
getInstance() |
static ASREngine |
getInstanceSnapshot()
获取 ASREngine 实例快照
|
java.lang.String |
getVadDump()
获取vad dump info
|
long |
getVadPauseTime()
获取VAD后端停顿时间的接口
|
java.lang.String |
getVadVersion()
获取vad版本:lua版本 - c版本 接口
|
boolean |
setVadPauseTime(long millis)
设置VAD后端停顿时间的接口
若VAD在用户说话时停顿超过一定的时间,则认为用户已经说完,发出sys.vad.end消息,结束录音。
|
void |
startListening(ASREngine.Callback callback)
主动开始识别
|
void |
stopListening()
主动结束识别
|
public static final java.lang.String TAG
public static final int TIMEOUT_ASR
public static ASREngine getInstance()
public static ASREngine getInstanceSnapshot()
public void startListening(ASREngine.Callback callback) throws DDSNotInitCompleteException
调用后直接进入识别,识别结果通过ASREngine.Callback
返回。
若当前正在对话中,会先结束当前对话,再开启识别。
若产品开启VAD,用户结束说话之后会自动结束识别,无须调用stopListening()
callback
- 识别结果通的回调接口。识别结束或取消后,将被清除。DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic boolean setVadPauseTime(long millis) throws DDSNotInitCompleteException
millis
- 后端停顿时间,单位为毫秒。默认值为500毫秒。DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic long getVadPauseTime() throws DDSNotInitCompleteException
DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic java.lang.String getVadVersion() throws DDSNotInitCompleteException
DDSNotInitCompleteException
public java.lang.String getVadDump() throws DDSNotInitCompleteException
DDSNotInitCompleteException
public boolean enableVad() throws DDSNotInitCompleteException
DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic boolean disableVad() throws DDSNotInitCompleteException
DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic void stopListening() throws DDSNotInitCompleteException
调用后,最终识别结果会通过ASREngine.Callback.finalResults(String)
回调,然后ASREngine.Callback
将会被清除。
DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionpublic void cancel() throws DDSNotInitCompleteException
调用后,ASREngine.Callback
将会被清除,并不再触发任何回调。
DDSNotInitCompleteException
- 如果DDS没有初始化完成,会抛出exceptionprotected void destroy()