是否可以从 Cortana 语音命令中读取任何值?
例如,当我说:
“在我的图书馆中搜索{something}”
我想从我的应用中的 {something} 获取结果。
我找到了如何与短语表 and 短语主题,但就我而言,可以是任何单词,而不是某些声明的项目或一个主题。
在您的 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);
某些东西将是搜索和我的图书馆之间的一切
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)