WatchKit:WatchKit应用程序中的语音到文本转换 [英] WatchKit: Speech to text conversion in WatchKit Apps
问题描述
任何人都可以帮我提供一个示例代码,用于在Apple Watchkit应用程序中添加Speech to Text转换功能。
Can any one help me with a sample code for adding Speech to Text conversion feature in Apple Watchkit apps.
推荐答案
Yes, it's possible. Here is the documentation: https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/index.html#//apple_ref/occ/instm/WKInterfaceController/presentTextInputControllerWithSuggestions:allowedInputMode:completion:
代码如下所示。您提供带有单词的建议数组(或表情符号),并设置允许输入模式,该模式只能接受动画表情符号,表情符号或计划文本。
The code look like this. You provide a suggestions array with words (or emoji too) and you set the allowed input mode that can accept animated emoji, emoji or plan text only.
[self presentTextInputControllerWithSuggestions:@[@"hello", @"world"] allowedInputMode:WKTextInputModePlain completion:^(NSArray *results) {
NSLog(@"results: %@", results);
}];
结果如下:
< img src =https://i.stack.imgur.com/UYdkS.pngalt =在此处输入图像说明>
这篇关于WatchKit:WatchKit应用程序中的语音到文本转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!