我想知道是否有办法在离线模式下使用iOS语音识别.根据文档(https://developer.apple.com/reference/speech),我没有看到任何相关内容.
我知道有一个内置的模板.
我转到文件菜单,然后选择新建>目标
从左侧窗格中选择iOS>应用程序扩展.
现在选择Intents扩展名.
这将创建两个新组:YourExtension和YourExtensionUI.如果打开YoureExtension组,您将看到IntentHandler.swift,其中包含一些用于处理锻炼的示例代码.
这是一个让您入门的更简单的示例:
class IntentHandler: INExtension, INSendMessageIntentHandling {
override func handler(for intent: INIntent) -> AnyObject {
// This is the default implementation. If you want different objects to handle different intents,
// you can override this and return the handler you want for that particular intent.
return self
}
func handle(sendMessage intent: INSendMessageIntent, completion: (INSendMessageIntentResponse) -> Void) {
print("Send message: " + (intent.content ?? "No message"))
let response = INSendMessageIntentResponse(code: .success, userActivity: nil)
completion(response)
}
}
Run Code Online (Sandbox Code Playgroud)
我做到了,没关系. …
I want to use this function's prototype for adding vocabulary to SiriKit. Apple's documentation shows the following sample code:
let workoutNames = self.sortedWorkoutNames()
let vocabulary = INVocabulary.shared()
vocabulary.setVocabularyStrings(workoutNames, of: .workoutActivityName)
Run Code Online (Sandbox Code Playgroud)
According to the documentation, I need to use an NSOrderedSet type for self.sortedWorkoutNames().
How to declare it and set it with an array of Strings?
EDIT: About the context project, I'm using Intents with Siri. The goal here, is to use specific word like 'Benchpress' or …