专栏首页播放刘德华的歌腾讯云语音识别python-sdk使用笔记
原创

腾讯云语音识别python-sdk使用笔记

官方文档说明:https://cloud.tencent.com/document/product/1093/35726

接入准备

SDK 获取

实时语音识别 Python SDK 以及 Demo 的下载地址:Python3 SDKPython2 SDK

下载下来并且解压

其实我是推荐使用python3的,因为python2停止维护了。

sdk下载路径

我的路径在:F:\code\ASR

接入须知

开发者在调用前请先查看实时语音识别的 接口说明,了解接口的使用要求使用步骤

开发环境

  • 环境依赖 该接口支持 Python3 和 Python2.7 版本,请用户根据需要选择。
  • 安装 requests 方法1:pip install requests 。 方法2:先下载 requests,然后进入下载目录执行:python setup.py install 。

返回的结果

D:\ProgramData\Anaconda3\python.exe E:/code/ASR/python_realtime_asr_sdk_v3/python_realtime_asr_sdk/src/com_tencent_asr_sdk/RasrClient.py

b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":0,"text":"","result_number":1,"result_list":[{"slice_type":0,"index":1,"start_time":0,"end_time":256,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":1,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":512,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":2,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":768,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":3,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1024,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":4,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1280,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":5,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1536,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":6,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1792,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":7,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2048,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":8,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2304,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":9,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2560,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":10,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2816,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe3\x80\x82","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":11,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":3072,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":12,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":3328,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":13,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":3584,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":14,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":3840,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":15,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":2,"index":1,"start_time":0,"end_time":4062,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":1}'
Final result: b'{"code":0,"message":"success","voice_id":"fzQsMai10dyqy4JY","seq":15,"text":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","result_number":1,"result_list":[{"slice_type":2,"index":1,"start_time":0,"end_time":4062,"voice_text_str":"\xe5\x8c\x97\xe4\xba\xac\xe7\xa7\x91\xe6\x8a\x80\xe9\xa6\x86\xe3\x80\x82","word_size":0,"word_list":[]}],"final":1}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":0,"text":"","result_number":1,"result_list":[{"slice_type":0,"index":1,"start_time":0,"end_time":512,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":1,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1024,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":2,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":1536,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":3,"text":"","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2048,"voice_text_str":"","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":4,"text":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":2560,"voice_text_str":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":5,"text":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","result_number":1,"result_list":[{"slice_type":1,"index":1,"start_time":0,"end_time":3072,"voice_text_str":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","word_size":0,"word_list":[]}],"final":0}'
b'{"code":0,"message":"success","voice_id":"GTDUCUtTKpSq0gjq","seq":6,"text":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","result_number":1,"result_list":[{"slice_type":2,"index":1,"start_time":0,"end_time":3093,"voice_text_str":"\xe5\x90\x83\xe9\xa5\xad\xe4\xba\x86\xe5\x90\x97\xef\xbc\x9f","word_size":0,"word_list":[]}],"final":1}'

Process finished with exit code 0

常见问题

1. python3 SDK密钥的输入

原创声明,本文系作者授权云+社区发表,未经许可,不得转载。

如有侵权,请联系 yunjia_community@tencent.com 删除。

相关文章

  • 教你怎么使用机票行程识别接口

    https://console.cloud.tencent.com/api/explorer?Product=ocr&Version=2018-11-19&Ac...

    算法发
  • 关于人脸识别QPS的问题

    https://cloud.tencent.com/document/product/867/17640

    算法发
  • 腾讯云录音文件识别

    帮助文档:https://cloud.tencent.com/document/product/1093/38351

    算法发
  • 种草 ES2020 新特性,真的学不动了

    https://juejin.im/post/5e09ca40518825499a5abff7

    coder_koala
  • ArrayList浅、深拷贝

    ArrayList深拷贝和浅拷贝。ArrayList的clone()方法用于创建list的浅表副本。在新列表中,仅复制对象引用。如果我们在第一个ArrayLis...

    FunTester
  • K8S 生态周报| Helm v3.2.1 发布

    「K8S 生态周报」内容主要包含我所接触到的 K8S 生态相关的每周值得推荐的一些信息。欢迎订阅知乎专栏「k8s 生态」 ( https://zhuanlan....

    Jintao Zhang
  • UI自动化(Webdriver+Appnium通吃方案)中验证码的识别方法(源代码)

    下载 tesseract-ocr-setup-3.02.02.exe安装(双击一路下一步然后finish),然后把tesseract-ocr的的安装目录添加到系...

    Criss@陈磊
  • Kubernetes Scheduler的Predicates和Priorities Policies解读

    本文是对Kubernetes V1.5 Scheduler 的预选策略Predicates Policies和优选策略Priorities Policies的含...

    Walton
  • TODO指南:启动开源项目

    一旦公司参与开源社区已有足够长的时间来建立声誉,它就能够发布自己的开源项目。在开源参与的这个阶段,公司可以从开放式协作中获得最大的好处。您可以开放可用于社区的专...

    CNCF
  • Mybatis-Plus代码生成器

    乐心湖

扫码关注云+社区

领取腾讯云代金券