public class AsrIntent extends Object
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
AsrIntent.AsrAudioSrcType |
Enumerates ASR audio source types.
|
static class |
AsrIntent.AsrEngineType |
Enumerates ASR engine types.
|
| 构造器 | 说明 |
|---|---|
AsrIntent() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getAudioSourceType() |
Obtains the audio source type.
|
int |
getEngineType() |
Obtains the ASR engine type.
|
String |
getFilePath() |
Obtains the path of an audio file.
|
int |
getTimeoutThresholdMs() |
Obtains the ASR timeout threshold.
|
int |
getVadEndWaitMs() |
Obtains the post-VAD threshold.
|
int |
getVadFrontWaitMs() |
Obtains the pre-VAD threshold.
|
void |
setAudioSourceType(AsrIntent.AsrAudioSrcType audioSourceType) |
Sets the audio source type.
|
void |
setEngineType(AsrIntent.AsrEngineType engineType) |
Sets the ASR engine type.
|
void |
setFilePath(String filePath) |
Sets the path of the audio file to be recognized.
|
void |
setTimeoutThresholdMs(int timeoutThresholdMs) |
Sets the ASR timeout threshold.
|
void |
setVadEndWaitMs(int vadEndWaitMs) |
Sets the post-VAD threshold.
|
void |
setVadFrontWaitMs(int vadFrontWaitMs) |
Sets the pre-VAD threshold.
|
public int getVadEndWaitMs()
If the silence period in the middle of a user's utterances reaches the post-VAD threshold, speech recognition will stop.
public void setVadEndWaitMs(int vadEndWaitMs)
If the silence period in the middle of a user's utterances reaches the post-VAD threshold, speech recognition will stop.
vadEndWaitMs - Indicates the post-VAD threshold. The value ranges from 500 to 10000 (default value: 2000},
in milliseconds. If this parameter is set to a value beyond this range, the valid post-VAD threshold set
most recently will be used.public int getVadFrontWaitMs()
If the silence period before any utterances are captured reaches the pre-VAD threshold, speech recognition will stop.
public void setVadFrontWaitMs(int vadFrontWaitMs)
If the silence period before any utterances are captured reaches the pre-VAD threshold, speech recognition will stop.
vadFrontWaitMs - Indicates the pre-VAD threshold. The value ranges from 500 to 10000 (default value: 4800),
in milliseconds. If this parameter is set to a value beyond this range, the valid pre-VAD threshold set
most recently will be used.public int getTimeoutThresholdMs()
public void setTimeoutThresholdMs(int timeoutThresholdMs)
The input parameter timeoutThresholdMs takes effect in
AsrClient.startListening(AsrIntent) but not in
AsrClient.init(AsrIntent, AsrListener).
timeoutThresholdMs - Indicates the ASR timeout threshold. The value ranges from 1 to 20000 (default value:
20000), in milliseconds. If this parameter is set to a value beyond this range, the invalid ASR timeout
threshold set most recently will be used.public String getFilePath()
public void setFilePath(String filePath)
To ensure that ASR can take effect on audio files, you must
call setAudioSourceType(ohos.ai.asr.AsrIntent.AsrAudioSrcType)
with AsrAudioSrcType#ASR_SRC_TYPE_FILE as the input parameter before calling
AsrClient#init(AsrIntent, AsrListener) to initialize the ASR engine.
filePath - Indicates the path of the audio file to be recognized.public int getAudioSourceType()
AsrAudioSrcType.public void setAudioSourceType(AsrIntent.AsrAudioSrcType audioSourceType)
audioSourceType - Indicates the audio source type. The default value is
AsrAudioSrcType#ASR_SRC_TYPE_FILE.public int getEngineType()
AsrEngineType.public void setEngineType(AsrIntent.AsrEngineType engineType)
engineType - Indicates the ASR engine type. The default value is
AsrEngineType#ASR_ENGINE_TYPE_LOCAL.AsrIntent.AsrEngineType