在vcd文件规范中,它说{*}用于匹配任何东西。但是,对于示例命令:
<Command Name="addFoodLog">
<Example> I had a burger for lunch </Example>
<!--Recording a drink-->
<ListenFor RequireAppName="BeforeOrAfterPhrase"> [I] drank [a] {*} with [my] {mealtime} </ListenFor>
<!--Recording a meal-->
<ListenFor RequireAppName="BeforeOrAfterPhrase"> [I] ate [a] {*} for [my] {mealtime} </ListenFor>
<ListenFor RequireAppName="BeforeOrAfterPhrase"> [I'm] having {*} for [my] {mealtime} </ListenFor>
<ListenFor RequireAppName="BeforeOrAfterPhrase"> [I] [just] had [a] {*} for {mealtime} </ListenFor>
<Feedback> Recording your {mealtime}</Feedback>
<Navigate />
</Command>打印此输入的结果将是I drank a ... with my dinner
有什么办法能从课文中得到真正的答案吗?或者这是个错误?
发布于 2016-04-05 22:15:37
如果你使用一个短语主题,那么你会解决你的问题,因为它会增加一个更大的词汇量。
以下是一个例子:
<PhraseTopic Label="food">
<Subject>Food</Subject>
<Subject>Drink</Subject>
<Subject>Meal</Subject>
<Subject>Food</Subject>
</PhraseTopic>查看语音命令定义元素和属性以获取更多信息
发布于 2016-06-14 18:36:20
下面是如何获得一个搜索词,而不是从一个值的列表。这是针对HTML/JS的,而不是XAML,但是应该给您一个好主意。
XML
<?xml version="1.0" encoding="utf-8" ?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
<CommandSet xml:lang="en-us" Name="FNOW_en-us">
<AppName> YourAppName </AppName>
<Example> Search books </Example>
<Command Name="SearchFor">
<Example> Search for Harry Potter </Example>
<ListenFor RequireAppName="BeforeOrAfterPhrase"> find book {SearchTerm} </ListenFor>
<Feedback> Searching books </Feedback>
<Navigate />
</Command>
<PhraseTopic Label="SearchTerm" Scenario="Search"/>
</CommandSet>
</VoiceCommands>JavaScript
function handleVoiceCommand(args) {
var command,
commandResult,
commandName = '',
commandProperties = {};
if (args.detail && args.detail.detail) {
command = args.detail.detail[0];
if (command) {
commandResult = command.result;
if (commandResult) {
if (commandResult.rulePath) {
commandName = commandResult.rulePath[0];
}
if (commandResult.semanticInterpretation) {
commandProperties = commandResult.semanticInterpretation.properties;
}
// Act on the different commands.
// Command Names are defined within VoiceCommands.xml.
switch(commandName) {
case 'SearchFor':
console.log('Cortana Command: SearchFor');
console.log('Search Term: ' + commandProperties.SearchTerm[0]);
break;
}
}
}
}
}
WinJS.Application.addEventListener('activated', function (args) {
var appLaunchVoiceCommand;
appLaunchVoiceCommand = Windows.ApplicationModel.Activation.ActivationKind.voiceCommand || 16;
if (args.detail.kind === appLaunchVoiceCommand) {
return handleVoiceCommand(args);
}
});
WinJS.Application.start();https://stackoverflow.com/questions/36375767
复制相似问题