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 May 25, 11:48
@Gshocklighting @edgarwright here's a whole video interview with him that's pretty much the same http://t.co/bVzsquiHwQ

Twitter May 24, 18:15
@edbott I feel the same about hotmail, gmail or http://t.co/JRxMhkHJpG addresses

Twitter May 23, 21:21
@xamarinhq this is annoying, just make all videos available while the content is still relevant

Twitter May 22, 13:50
@APPNATION @DonDodge the new xbox isn't about gaming, it's about entertainment. it's what everyone was waiting for Apple to do with TV

Twitter May 21, 22:22
@Enderle that "future is in streaming" answer was after HD DVD lost (they had an external drive for X360)

@EShy