WatchKit:WatchKit应用程序中的语音到文本转换 [英] WatchKit: Speech to text conversion in WatchKit Apps

查看:170
本文介绍了WatchKit:WatchKit应用程序中的语音到文本转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我提供一个示例代码,用于在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.

推荐答案

是, 这是可能的。以下是文档:
https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/index.html#//apple_ref/occ/instm/ WKInterfaceController / presentTextInputControllerWithSuggestions:allowedInputMode:completion

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆