ios – IBM Watson Speech To Text:无法使用swift sdk转录文本

ios – IBM Watson Speech To Text:无法使用swift sdk转录文本,第1张

概述我正在使用IBM Watson语音来发送iOS sdk来转录实时音频.我已经通过可可豆荚安装了它.在将音频转录为文本时,我遇到了问题(身份验证). 已安装的STT sdk版本为0.38.1. 我已经配置了所有内容,正确创建了服务和凭据,并确保使用正确的apikey和URL实例化SpeechToText.每当我调用startStreaming方法时,STT sdk会打印一些错误日志,这似乎与身份验证 我正在使用IBM Watson语音来发送iOS sdk来转录实时音频.我已经通过可可豆荚安装了它.在将音频转录为文本时,我遇到了问题(身份验证).

已安装的STT sdk版本为0.38.1.

我已经配置了所有内容,正确创建了服务和凭据,并确保使用正确的APIkey和URL实例化SpeechToText.每当我调用startStreaming方法时,STT sdk会打印一些错误日志,这似乎与身份验证挑战有关.

这是代码片段.

let speechToText = SpeechToText(APIKey: Credentials.SpeechToTextAPIKey,iamUrl: Credentials.SpeechToTextURL)var accumulator = SpeechRecognitionResultsAccumulator()func startStreaming() {  var settings = RecognitionSettings(ContentType: "audio/ogg;codecs=opus")  settings.interimResults = true  let failure = { (error: Error) in print(error) }  speechToText.recognizeMicrophone(settings: settings,failure: failure) { results in  accumulator.add(results: results)  print(accumulator.bestTranscript) }}

错误日志

CredStore - performquery - Error copying matching creds.  Error=-25300,query={class = inet;"m_limit" = "m_limitAll";ptcl = htps;"r_Attributes" = 1;sdmn = "IBM Watson Gateway(Log-in)";srvr = "gateway-syd.watsonplatform.net";sync = syna;}

我已经挖掘了IBM Watson sdk文档,甚至用Google搜索了这个问题,但没有找到任何相关的答案.

任何帮助将受到高度赞赏.

解决方法 随着SpeechToTextV1更改发布了新的版本 1.0.0的Swift SDK,下面的代码适用于我的语音到文本服务API密钥.

除非在达拉斯以外的地区创建服务,否则您不必广泛传递URL.检查URL here

import SpeechToTextV1 // If sdk is installed using Carthage. import SpeechToText // If sdk is installed as a pod let APIKey = "your-API-key"let speechToText = SpeechToText(APIKey: APIKey)var accumulator = SpeechRecognitionResultsAccumulator()func startStreaming() {    var settings = RecognitionSettings(ContentType: "audio/ogg;codecs=opus")    settings.interimResults = true    speechToText.recognizeMicrophone(settings: settings) { response,error in        if let error = error {            print(error)        }        guard let results = response?.result else {            print("Failed to recognize the audio")            return        }        accumulator.add(results: results)        print(accumulator.bestTranscript)    }}func stopStreaming() {    speechToText.stopRecognizeMicrophone()}

您可以找到更多示例here

希望这可以帮助!!

总结

以上是内存溢出为你收集整理的ios – IBM Watson Speech To Text:无法使用swift sdk转录文本全部内容,希望文章能够帮你解决ios – IBM Watson Speech To Text:无法使用swift sdk转录文本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1033422.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存