- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在 pod 规范和当前 S.O. 上的内容之间我很难弄清楚如何使用 SpeechKit + CocoaPod + Swift 进行语音到文本的工作。终于让它工作了,所以我想我会帮助下一个寻求帮助的可怜人! :)
最佳答案
#import <SpeechKit/SpeechKit.h>
到你的桥接头然后创建一个 UIViewController 并使用正确的凭据添加以下代码:
import UIKit
import SpeechKit
class SpeechKitDemo: UIViewController, SKTransactionDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//!!link this to a corresponding button on the UIViewController in I.B.
@IBAction func tappedButton(sender: AnyObject) {
// All fields are required.
// Your credentials can be found in your Nuance Developers portal, under "Manage My Apps".
let SKSAppKey = "[Get this from the nuance app info page]";
let SKSAppId = "[Get this from the nuance app info page]";
let SKSServerHost = "[Get this from the nuance app info page]";
let SKSServerPort = "[Get this from the nuance app info page]";
let SKSLanguage = "eng-USA";
let SKSServerUrl = "nmsps://\(SKSAppId)@\(SKSServerHost):\(SKSServerPort)"
let session = SKSession(URL: NSURL(string: SKSServerUrl), appToken: SKSAppKey)
//this starts a transaction that listens for voice input
let transaction = session.recognizeWithType(SKTransactionSpeechTypeDictation,
detection: .Short,
language: SKSLanguage,
delegate: self)
print(transaction)
}
//required delegate methods
func transactionDidBeginRecording(transaction: SKTransaction!) { }
func transactionDidFinishRecording(transaction: SKTransaction!) { }
func transaction(transaction: SKTransaction!, didReceiveRecognition recognition: SKRecognition!) {
//Take the best result
let topRecognitionText = recognition.text;
print("Best rec test: \(topRecognitionText)")
//Or iterate through the NBest list
let nBest = recognition.details;
for phrase in (nBest as! [SKRecognizedPhrase]!) {
let text = phrase.text;
let confidence = phrase.confidence;
print("\(confidence): \(text)")
}
}
func transaction(transaction: SKTransaction!, didReceiveServiceResponse response: [NSObject : AnyObject]!) { }
func transaction(transaction: SKTransaction!, didFinishWithSuggestion suggestion: String!) { }
func transaction(transaction: SKTransaction!, didFailWithError error: NSError!, suggestion: String!) { }
}
关于ios - 在 Swift 中使用 CocoaPods 时如何实现 Nuance Speechkit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35983121/
是否可以使用 Nuance 的 iOS 版 SpeechKit 将音频或视频文件用作源,而不是自动使用麦克风? 我在这里创建了一个项目: https://github.com/jeffreality/
我正在尝试在 iOS Swift 应用程序中实现语音识别。当用户点击“麦克风”按钮时,我尝试播放系统声音,然后使用 SpeechKit 进行语音识别。如果我注释掉 SpeechKit 代码,语音识别工
我在使用 Swift 的应用程序中使用 SpeechKit(免费帐户)进行语音到文本的转换。它工作得很好,但在我测试的所有设备上突然停止工作。我已经交叉检查,应用程序 key 和 ID 是正确的。这是
我有一个应用程序,我们需要根据语音命令打开某些屏幕,比如如果用户说“打开设置”,那么它应该打开设置屏幕,到目前为止我已经使用了 SpeechKit框架,但我无法检测到语音静音的结束。就像 Siri 的
我已经使用此 CocoaPod 实现了 Nuance SpeechKit https://cocoapods.org/pods/SpeechKit并执行 accepted S.O. answer 中的
我正在使用 Nuance 的 SpeechKit 在录制视频时转录视频中的文本。但是,当 SpeechKit 处于事件状态时,AVAudioSession 会生成以下错误: AVAudioSessio
我刚刚下载了用于 iOS 开发的 Dragon Mobile SDK,并尝试使用 SpeechKit 创建一个应用程序。我遵循了 Dragon Mobile SDK Reference,但我不断在日志
我们已经实现了用于听写的 SpeechKit。它工作正常,但有时会因某些用户而崩溃。当用户点击开始录制音频引擎时。 代码: if recognitionTask != nil {
我尝试为 watchOS 导入 SpeechKit 框架,但收到错误消息。有没有办法将它与 watch 一起使用?导入 Speechkit 框架时出现错误,提示“没有这样的语音模块” import W
我已将 Speechkit 大量集成到我的一个应用程序的 View Controller 中。 Speechkit 仅在 iOS 10 上可用,但我还需要我的应用程序在 iOS 9 设备上运行。 现在
在 pod 规范和当前 S.O. 上的内容之间我很难弄清楚如何使用 SpeechKit + CocoaPod + Swift 进行语音到文本的工作。终于让它工作了,所以我想我会帮助下一个寻求帮助的可怜
我正在使用 Nuance 的 Speechkit 2 和 swift、iOS 9.3。根据此文档,我需要检测 TTS 何时完成: https://developer.nuance.com/public
我正在尝试使用 Nuance Speechkit 并构建一个可以生成语音转录的语音识别应用程序。在 Nuance 中识别语音的方法给出错误:在调用方法时模棱两可地使用 recognize(withTy
我是一名优秀的程序员,十分优秀!