public class WxMpAiOpenServiceImpl extends Object implements WxMpAiOpenService
Created by BinaryWang on 2018/6/9.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
TRANSLATE_URL |
VOICE_QUERY_RESULT_URL, VOICE_UPLOAD_URL| 构造器和说明 |
|---|
WxMpAiOpenServiceImpl(WxMpService wxMpService) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
queryRecognitionResult(String voiceId,
AiLangType lang)
获取语音识别结果.
|
String |
recogniseVoice(String voiceId,
AiLangType lang,
File voiceFile)
识别指定语音文件内容.
|
String |
translate(AiLangType langFrom,
AiLangType langTo,
String content)
微信翻译.
|
void |
uploadVoice(String voiceId,
AiLangType lang,
File voiceFile)
提交语音.
|
public WxMpAiOpenServiceImpl(WxMpService wxMpService)
public void uploadVoice(String voiceId, AiLangType lang, File voiceFile) throws WxErrorException
WxMpAiOpenService提交语音. 接口调用请求说明 http请求方式: POST http://api.weixin.qq.com/cgi-bin/media/voice/addvoicetorecofortext?access_token=ACCESS_TOKEN&format=&voice_id=xxxxxx&lang=zh_CN 参数说明 参数 是否必须 说明 access_token 是 接口调用凭证 format 是 文件格式 (只支持mp3,16k,单声道,最大1M) voice_id 是 语音唯一标识 lang 否 语言,zh_CN 或 en_US,默认中文 语音内容放body里或者上传文件的形式
uploadVoice 在接口中 WxMpAiOpenServicevoiceId - 语音唯一标识lang - 语言,zh_CN 或 en_US,默认中文voiceFile - 语音文件WxErrorExceptionpublic String recogniseVoice(String voiceId, AiLangType lang, File voiceFile) throws WxErrorException
WxMpAiOpenServicerecogniseVoice 在接口中 WxMpAiOpenServicevoiceId - 语音唯一标识lang - 语言,zh_CN 或 en_US,默认中文voiceFile - 语音文件WxErrorExceptionpublic String translate(AiLangType langFrom, AiLangType langTo, String content) throws WxErrorException
WxMpAiOpenService微信翻译. 接口调用请求说明 http请求方式: POST http://api.weixin.qq.com/cgi-bin/media/voice/translatecontent?access_token=ACCESS_TOKEN&lfrom=xxx<o=xxx 参数说明 参数 是否必须 说明 access_token 是 接口调用凭证 lfrom 是 源语言,zh_CN 或 en_US lto 是 目标语言,zh_CN 或 en_US 源内容放body里或者上传文件的形式(utf8格式,最大600Byte)
translate 在接口中 WxMpAiOpenServicelangFrom - 源语言,zh_CN 或 en_USlangTo - 目标语言,zh_CN 或 en_UScontent - 要翻译的文本内容WxErrorExceptionpublic String queryRecognitionResult(String voiceId, AiLangType lang) throws WxErrorException
WxMpAiOpenService获取语音识别结果. 接口调用请求说明 http请求方式: POST http://api.weixin.qq.com/cgi-bin/media/voice/queryrecoresultfortext?access_token=ACCESS_TOKEN&voice_id=xxxxxx&lang=zh_CN 请注意,添加完文件之后10s内调用这个接口 参数说明 参数 是否必须 说明 access_token 是 接口调用凭证 voice_id 是 语音唯一标识 lang 否 语言,zh_CN 或 en_US,默认中文
queryRecognitionResult 在接口中 WxMpAiOpenServicevoiceId - 语音唯一标识lang - 语言,zh_CN 或 en_US,默认中文WxErrorExceptionCopyright © 2018. All rights reserved.