You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xfyun_voice.py 919B

1234567891011121314151617181920212223242526272829303132333435
  1. """
  2. 科大讯飞 voice service
  3. """
  4. from voice.voice import Voice
  5. # 科大讯飞语音识别
  6. lfasr_host = 'http://raasr.xfyun.cn/api'
  7. # 请求的接口名
  8. api_prepare = '/prepare'
  9. api_upload = '/upload'
  10. api_merge = '/merge'
  11. api_get_progress = '/getProgress'
  12. api_get_result = '/getResult'
  13. # 文件分片大小10M
  14. file_piece_sice = 10485760
  15. # ——————————————————转写可配置参数————————————————
  16. # 参数可在官网界面(https://doc.xfyun.cn/rest_api/%E8%AF%AD%E9%9F%B3%E8%BD%AC%E5%86%99.html)查看,根据需求可自行在gene_params方法里添加修改
  17. # 转写类型
  18. lfasr_type = 0
  19. # 是否开启分词
  20. has_participle = 'false'
  21. has_seperate = 'true'
  22. # 多候选词个数
  23. max_alternatives = 0
  24. # 子用户标识
  25. suid = ''
  26. class XfyunVoice(Voice):
  27. def __init__(self):
  28. pass
  29. def voiceToText(self, voice_file):
  30. pass