首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure Speech to Text教程

Azure Speech to Text教程
EN

Stack Overflow用户
提问于 2019-07-04 16:58:51
回答 1查看 2.8K关注 0票数 2

我想使用Azure Speech to Text将音频文件转换为文本数据。有没有人知道这方面的好教程?我可以在下面找到一个教程:https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstart-python

但样本的音频源来自麦克风,而不是音频文件。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2019-07-05 10:47:03

有一个名为whatstheweatherlike.wav的官方音频样本,你可以从GitHub Repo Azure-Samples/cognitive-services-speech-sdksamples/csharp/sharedcontent/console/whatstheweatherlike.wav获得。

下面是我编写的示例代码,部分引用了官方教程Quickstart: Recognize speech with the Speech SDK for Python。我通过pip install azure-cognitiveservices-speech为语音安装了Azure Cognitive Services SDK的当前版本1.6.0

代码语言:javascript
复制
import azure.cognitiveservices.speech as speechsdk

speech_key, service_region = "<your api key>", "<your region>"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)

audio_config = speechsdk.audio.AudioConfig(filename='whatstheweatherlike.wav')
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
result = speech_recognizer.recognize_once()
print(result.text)

从音频样本文件中识别出的文本如下。

代码语言:javascript
复制
What's the weather like?

希望能有所帮助。

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

https://stackoverflow.com/questions/56884243

复制
相关文章

相似问题

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