语音识别模块 - 基于 LAS ASR 服务的录音转写解决方案
提交 ASR 识别任务。
参数 | 类型 | 必填 | 示例值 | 说明 | ||
|---|---|---|---|---|---|---|
operator_id | string | 是 | las_asr | 算子Id | ||
operator_version | string | 是 | v2 | 算子版本 | ||
data | SpeechRecognition | 是 | 请求数据 | |||
user | UserConfig | 否 | 用户相关配置 | |||
uid | string | 否 | 用户标识 | |||
audio | Audio | 是 | 音频相关配置 | |||
url | string | 是 | 音频链接 | |||
language | string | 否 | en-US | 当该键为空时,该模型支持中英文、上海话、闽南语,四川、陕西、粤语识别。当将其设置为下方特定键时,它可以识别指定语言。 英语:en-US 日语:ja-JP 印尼语:id-ID 西班牙语:es-MX 葡萄牙语:pt-BR 德语:de-DE 法语:fr-FR 韩语:ko-KR 菲律宾语:fil-PH 马来语:ms-MY 泰语:th-TH 阿拉伯语:ar-SA | ||
format | string | 是 | mp3 | 音频容器格式 | ||
codec | string | 否 | 音频编码格式 | |||
rate | integer | 否 | 音频采样率 | |||
bits | integer | 否 | 音频采样点位数 | |||
channel | integer | 否 | 音频声道数 | |||
resource | string | 否 | bigasr | 可选值为 "bigasr" 与 "seedasr",其中默认值为"bigasr"。 | ||
request | RequestConfig | 是 | 请求相关配置 | |||
model_name | string | 是 | bigmodel | 模型名称,目前只有bigmodel | ||
enable_itn | boolean | 否 | true | 默认为true。 | ||
enable_punc | boolean | 否 | false | 默认为false。 | ||
enable_ddc | boolean | 否 | false | 默认为false。 | ||
enable_channel_split | boolean | 否 | false | 默认为false。 | ||
show_utterances | boolean | 否 | false | 输出语音停顿、分句、分词信息 | ||
vad_segment | boolean | 否 | false | 默认为false,默认是语义分句。 | ||
end_window_size | integer | 否 | 800 | 范围300 - 5000ms,建议设置800ms或者1000ms,比较敏感的场景可以配置500ms或者更小。(如果配置的过小,则会导致分句过碎,配置过大会导致不容易将说话内容分开。建议依照自身场景按需配置) | ||
sensitive_words_filter | string | 否 | 敏感词过滤功能,支持开启或关闭,支持自定义敏感词。该参数可实现:不处理(默认,即展示原文)、过滤、替换为*。 示例: system_reserved_filter //是否使用系统敏感词,会替换成*(默认系统敏感词主要包含一些限制级词汇) filter_with_empty // 想要替换成空的敏感词 filter_with_signed // 想要替换成 * 的敏感词
| |||
corpus | Corpus | 否 | 语料/干预词等 | |||
context | string | 否 | 热词直传,支持5000个热词 "context":"{"hotwords":[{"word":"热词1号"}, {"word":"热词2号"}]}" 上下文,限制800 tokens及20轮(含)内,超出会按照时间顺序从新到旧截断,优先保留更新的对话 context_data字段按照从新到旧的顺序排列,以下是反序列化后的例子,传入需要序列化为jsonstring(转义引号)
| |||
参数 | 类型 | 示例值 | 说明 | |
|---|---|---|---|---|
metadata | Metadata | 请求元信息 | ||
task_id | string | 异步模式下的任务id。 | ||
task_status | string | 异步模式下的任务状态。 | ||
business_code | string | 业务码 | ||
error_msg | string | 如有异常,会返回详细的异常信息。 | ||
request_id | string | 请求requestid | ||
curl --location "https://sd2a6d3q80c6ft26s2tv0.apigateway-cn-beijing.volceapi.com/api/v1/submit" \ --header "Content-Type: application/json" \ --header "Authorization: $LAS_API_KEY" \ --data ' { "operator_id": "las_asr", "operator_version": "v2", "data": { "audio": { "url": "https://las-ai-cn-beijing-baseline.tos-cn-beijing.volces.com/operator_cards_serving/public/baseline/las_asr/badaling.wav", "format": "mp3" }, "request": { "model_name": "bigmodel" } } }'
{ "metadata": { "task_id": "xxxxx123ef24ea40546c-las-asr", "task_status": "ACCEPTED", "business_code": "0", "error_msg": "", "request_id": "494022a8a0fc3eadb758cf8b0e8b20ef" } }
查询 ASR 识别任务状态。
参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|
operator_id | string | 是 | las_asr | 算子Id |
operator_version | string | 是 | v2 | 算子版本 |
task_id | string | 是 | 异步任务Id |
参数 | 类型 | 示例值 | 说明 | |||
|---|---|---|---|---|---|---|
metadata | Metadata | 请求的元信息,异步任务的id在其中的task_id字段下。 | ||||
task_id | string | 异步模式下的任务id。 | ||||
task_status | string | 异步模式下的任务状态。 | ||||
business_code | string | 业务码 | ||||
error_msg | string | 如有异常,会返回详细的异常信息。 | ||||
request_id | string | 请求requestid | ||||
data | AudioResponse | 返回的音频识别结果。 | ||||
audio_info | AudioInfo | 音频信息 | ||||
duration | integer | 音频时长,单位秒 | ||||
result | AudioResult | 音频识别结果 | ||||
text | string | 识别出的文本内容 | ||||
utterances | list of Utterance | 语音停顿、分句、分词信息 | ||||
additions | Additions | 额外信息,如说话人等 | ||||
emotion_degree | string | 情感强度 | ||||
emotion_degree_score | string | 情感强度得分 | ||||
emotion | string | 情感类型 | ||||
emotion_score | string | 情感类型得分 | ||||
gender | string | 性别 | ||||
gender_score | string | 性别得分 | ||||
speech_rate | string | 说话频率 | ||||
volume | string | 音量 | ||||
speaker | string | 说话人 | ||||
channel_id | string | 声道编号 | ||||
confidence | integer | 置信度 | ||||
end_time | integer | 结束时间 | ||||
start_time | integer | 起始时间 | ||||
text | string | 该部分文本内容 | ||||
words | list of Word | 单词相关信息 | ||||
confidence | integer | 置信度 | ||||
blank_duration | integer | 空白时长 | ||||
end_time | integer | 单词结束时间 | ||||
start_time | integer | 单词起始时间 | ||||
text | string | 单词文本 | ||||
additions | RequestAdditions | 额外信息 | ||||
duration | string | 音频时长 | ||||
lid_lang | string | 语种 | ||||
curl --location "https://sd2a6d3q80c6ft26s2tv0.apigateway-cn-beijing.volceapi.com/api/v1/poll" \ --header "Content-Type: application/json" \ --header "Authorization: $LAS_API_KEY" \ --data ' { "operator_id": "las_asr", "operator_version": "v2", "data": { "task_id": "xxxxx123ef24ea40546c-las-asr" } }'
{ "metadata": { "task_id": "xxxxx123ef24ea40546c-las-asr", "task_status": "COMPLETED", "business_code": "0", "error_msg": "", "request_id": "d204c21f5c7c8f8cfeb85d211b9c20ac" }, "data": { "audio_info": { "duration": 3575 }, "result": { "additions": { "duration": "3575" }, "text": "参观达*长城。", "utterances": [ { "additions": { "channel_id": "1" }, "end_time": 2320, "start_time": 640, "text": "参观达*长城。", "words": [ { "confidence": 0, "end_time": 920, "start_time": 640, "text": "参" }, { "confidence": 0, "end_time": 1120, "start_time": 920, "text": "观" }, { "confidence": 0, "end_time": 1480, "start_time": 1440, "text": "达" }, { "confidence": 0, "end_time": 1720, "start_time": 1680, "text": "*" }, { "confidence": 0, "end_time": 2080, "start_time": 1880, "text": "长" }, { "confidence": 0, "end_time": 2320, "start_time": 2080, "text": "城" } ] } ] } } }
HttpCode | 错误码 | 错误信息 | 说明 |
|---|---|---|---|
400 | Parameter.Invalid | The parameter is invalid. | 参数不合法 |
401 | Authorization.Missing | Missing Authorization. | 缺少鉴权 |
401 | ApiKey.Invalid | The api key is invalid. | API不合法 |
429 | Server.Busy | Server is Busy, please try again later. | 服务端繁忙限流 |
500 | Server.InternalError | 根据具体异常而定 | 业务异常 |