首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么必应服务的SpeechRecognition只能识别第一句话?

为什么必应服务的SpeechRecognition只能识别第一句话?
EN

Stack Overflow用户
提问于 2017-10-08 18:20:04
回答 1查看 822关注 0票数 0

我尝试了带有Bing ASR服务的SpeechRecognition package,以便用脚本转录the audio of this clip

代码语言:javascript
复制
#!/usr/bin/env python3

"""Recognize speech using Microsoft Bing Voice Recognition."""

import speech_recognition as sr

from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "input.wav")

# use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
    audio = r.record(source)  # read the entire audio file


# Microsoft Bing Voice Recognition API uses keys which are
# 32-character lowercase hexadecimal strings
BING_KEY = "FOOBAR - insert your key here"
try:
    print("Microsoft Bing Voice Recognition thinks you said:\n\n" +
          r.recognize_bing(audio, key=BING_KEY, language="de-DE"))
except sr.UnknownValueError:
    print("Microsoft Bing Voice Recognition could not understand audio")
except sr.RequestError as e:
    print(("Could not request results from Microsoft Bing Voice Recognition "
           "service; {0}").format(e))

它输出:

代码语言:javascript
复制
Microsoft Bing Voice Recognition thinks you said:

Reaser Was ist haben sie Lust mit dem Kino zu kommen war schon dass ich könnte den Film gar nicht folgen

显然,它是工作的,但它不转录完整的文件。为什么?我怎样才能让它转录完整的文件?

EN

回答 1

Stack Overflow用户

发布于 2017-10-08 19:18:41

问题是SpeechRecognition包使用REST接口而不是WebSocket接口。REST界面的音频长度限制为15秒。

来源:https://docs.microsoft.com/de-de/azure/cognitive-services/speech/home

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46629995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档