微信公众平台消息接口开发(40)语音识别
2013-07-23 17:11
141 查看
微信公众平台开发模式 微信 语音识别 公众平台 消息接口 语音识别
微信公众平台下的语音识别实现流程相当复杂。
It converts written words into audio. It accepts
The query string to convert to audio
Translation language, for example,
Encoding format, use default
微信公众平台下的语音识别实现流程相当复杂。
一、获取语音文件数据
目前可以通过模拟登录的方式获取语音文件二、对语音进行编码
一般接口对编码有指定要求,所以需要转码三、提交数据到第三方接口
获取识别结果与置信度,取最高值<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=zh-CN&maxresults=10"); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('1.flac')); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: audio/x-flac; rate=16000")); $data = curl_exec($ch); curl_close($ch); if ($data=json_decode($data,true)) { echo "<ul>"; foreach($data['hypotheses'] as $i) echo "<li>".$i['utterance']."</li>"; echo "</ul>"; } else { echo "<i>识别出错</i>"; } ?>
四、语义识别
通过语法规则对结果进行分析,可同时使用分词的方法来分析五、
其他:文本转语音Google Text to Speech API
Base URL: http://translate.google.com/translate_ttsIt converts written words into audio. It accepts
GETrequests.
GET
q
The query string to convert to audio
tl
Translation language, for example,
arfor Arabic, or
en-usfor English
ie
Encoding format, use default
UTF-8
Examples
This is an example for Arabic "السلام عليكم"
http://translate.google.com/translate_tts?ie=UTF-8&q=%D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85%20%D8%B9%D9%84%D9%8A%D9%83%D9%85&tl=ar
This is an example for English "Hello World"
http://translate.google.com/translate_tts?ie=UTF-8&q=Hello%20World&tl=en-us
相关文章推荐
- 微信公众平台消息接口开发(40)语音识别
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台开发模式 微信 语音识别 公众平台 消息接口 语音识别
- 微信公众平台消息接口开发(10)语音触发(非识别)
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- 微信公众平台消息接口开发(23)图片识别之男人味/女人味指数
- 微信公众平台消息接口开发(20)图片识别之人脸识别
- 微信公众平台消息接口开发(23)图片识别之男人味/女人味指数
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- 微信公众平台消息接口开发(20)图片识别之人脸识别
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- 微信公众平台消息接口开发(24)图片识别之人脸识别API
- 微信公众平台消息接口开发(23)图片识别之男人味/女人味指数
- 微信公众平台消息接口开发(20)图片识别之人脸识别
- 微信公众平台消息接口开发(20)图片识别之人脸识别