【问题标题】:Tutorial for Azure Speech to TextAzure Speech to Text 教程
【发布时间】:2019-11-14 23:27:27
【问题描述】:

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

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

谢谢。

【问题讨论】:

  • 你可以看看这个official docs,目前音频到文本不可用。
  • 我不知道。谢谢你:)
  • 不客气,请随时寻求更多帮助。

标签: azure speech-to-text


【解决方案1】:

有一个名为 whatstheweatherlike.wav 的官方音频样本,您可以从 GitHub 存储库 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 安装了当前版本的1.6.0 Azure Cognitive Services SDK for Speech。

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)

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

What's the weather like?

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 2021-01-31
    • 1970-01-01
    • 1970-01-01
    • 2017-06-11
    • 1970-01-01
    • 2019-05-03
    • 1970-01-01
    • 1970-01-01
    • 2022-12-14
    相关资源
    最近更新 更多