注册用户词典单词
POST/profilewords/:dgn/:pid
可以替换指定语音识别引擎和 profileId 的用户词典单词。
请求体的格式因连接的引擎而异。
- Hybrid 引擎: 使用
written(显示)和spoken(读音)注册单词。classname(类名)可以省略。 - End to End 引擎: 通过将
written(显示)替换为alternativewritten(替代显示)来强调单词。使用biasing(单词强调度,0 ~ 1,默认 0.5)指定强调的强度。
在 End to End 引擎中,也可以为相同的显示指定多个替代显示。这时,对于相同显示的单词将应用相同的单词强调度。如果在请求时为相同的显示指定了不同的单词强调度,则将采用请求中最先出现的单词强调度值。例如,为相同的显示"AMI"指定单词强调度 0.8 和未指定这 2 个条目时,将统一应用最先出现的条目所适用的值"0.8"。
请求
响应
- 200
- 400
- 401
- 404
- 422
- 500
以 JSON 格式返回注册单词的列表。
请求体不正确时返回。
| 响应体 | 错误情况 |
|---|---|
{"code":"-","message":"missing request body"} | 使用 POST 方法请求但未指定请求体时 |
{"code":"-","message":"invalid request body (<optionalMessage>)"} | 请求体作为 JSON 不正确时 |
API key(service 认证 key 字符串)认证失败时返回。
| 响应体 | 错误情况 |
|---|---|
{"code":"-","message":"can't verify service authorization"} | API key 认证失败时 |
{"code":"-","message":"service authorization has expired: <expirationTime> (<expiresIn>)"} | API key 的有效期已过时 |
未指定路径参数时返回。
| 响应体 | 错误情况 |
|---|---|
{"code":"?","message":"missing dictation grammar file name"} | 未指定连接引擎名称 <dgn> 时 |
{"code":"?","message":"missing profile id"} | 未指定 profileId <pid> 时 |
请求体中指定的 JSON 格式不符合预期时返回。
| 响应体 | 错误情况 |
|---|---|
{"code":"?","message":"missing profile words"} | JSON 格式不符合预期时 |
{"code":"?","message":"invalid written: <written>"} | 显示不正确时 |
{"code":"?","message":"invalid spoken: <spoken>"} | 读音不正确时 |
{"code":"?","message":"invalid class name: <className>"} | 单词类不正确时 |
{"code":"?","message":"invalid alternative written: <alternativeWritten>"} | 替代显示不正确时 |
发生意外异常时返回。
| 响应体 | 错误情况 |
|---|---|
{"code":"?","message":"unexpected exception occurred (<optionalMessage>)"} | 发生意外异常时 |