Voice Commands in Windows Phone 8 - Updating Phrase Lists at Run Time

by Ishai Hachlili 29. October 2012 12:45

In the previous post, I created a simple voice commands file and registered it with the WP OS.
My command was “Find {huntTypes} Hunts”.
huntTypes is a phrase list that was hardcoded in the VCD file with the following values: “New”, “Nearby” and “My”.

This means the user can say “Play The Hunt, Find New Hunts”.
I don’t really want to maintain this phrase list in the VCD file, instead I want to call a web service and get a list of types that my backend search can handle and update the phrase list.

It’s very simple to update the phrase list, you simply need to get the command set that includes the phrase list you want to update and call UpdatePhraseListAsync.

private void AddToPhraseList()
{
var vcs = VoiceCommandService.InstalledCommandSets["USEnglish"];
vcs.UpdatePhraseListAsync("huntTypes", new[] {"New", "Nearby", "My", "San Francisco", "New York"});
}

Now when the user says “Play The Hunt, Find San Francisco Hunts” the query string will include the added phrase list item

[0]: {[voiceCommandName, findHunts]}
[1]: {[reco, Play The Hunt Find San Francisco Hunts]}
[2]: {[huntTypes, San Francisco]}

Of course, in the real app I would get the list of phrases from some other source, instead of hardcoding it like I did in this sample.

Tags: , , ,

Speech Recognition | Windows Phone 8

blog comments powered by Disqus

About Me

Ishai Hachlili is a web and mobile application developer.

Currently working on Play The Hunt and The Next Line


Recent Tweets

Twitter October 23, 05:22
@BenThePCGuy a standard where that doesn't matter is better. One more reason to get the #Lumia920, wireless charging, no need for microUSB

Twitter October 23, 05:21
@ManMadeMoon where they dance around the issues and don't really talk about them

Twitter October 23, 05:20
@BenThePCGuy are you a @wpdev ?

Twitter October 23, 04:17
@JonahLupton But if it's black it's usually better

Twitter October 23, 02:58
@jongalloway next time ask your 5 year old how to spell

@EShy