win-universal-app - 从 Cortana 语音命令结果中获取任何值

标签 win-universal-app cortana

是否可以从 Cortana 语音命令中读取任何值?

例如,当我说:

"Search {something} in my library"

我想从我的应用中的 {something} 获取结果。

我找到了如何使用PhraseListPhraseTopic,但就我而言,可以是任何单词,而不是某些声明的项目或一个主题。

最佳答案

在您的 VoiceCommands.xml 中,您需要:

<PhraseTopic Label="something" Scenario="Natural Language">
  <Subject> Natural Language </Subject>
</PhraseTopic>

在您的 App.xaml.cs 中,您需要:

     private string SemanticInterpretation(string interpretationKey, SpeechRecognitionResult speechRecognitionResult)
    {
        return speechRecognitionResult.SemanticInterpretation.Properties[interpretationKey].FirstOrDefault();
    }
}

在 OnActivated 方法中(或任何您处理命令的地方) 你可以通过以下方式读出它:

switch (voiceCommandName)
       {
        case "something":
              string something = this.SemanticInterpretation("something", speechRecognitionResult);

某些东西将是搜索和我的图书馆之间的一切

关于win-universal-app - 从 Cortana 语音命令结果中获取任何值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33056223/

相关文章:

c# - 在 Azure 服务器和 UWP 客户端上实现 WebSocket

c# - cortana在后台任务中拥有自己的命令

speech-recognition - 无需网络的 Windows 通用应用程序连续听写

xaml - 将 MenuFlyout 添加到 RichEditBox UWP

sqlite - 无法加载 DLL 'sqlite3.dll' : The specified module could not be found in UWP Xamarin. 表单

c# - Windows uwp 中的中心命令栏按钮

c# - 罗斯林-CodeDom : HowTo dynamically compile Code to Universal-Windows-Library

windows-10 - Cortana 命令仅在说出时有效

node.js - 有没有一种方法可以通过 Electron/node.js应用程序访问诸如CORTANA的Windows API?

uwp - 如何让Cortana听懂造词的发音?