Hey,
I have been trying to create a set of grammar rules for a speech recognition program with an array, but cannot seem to accomplish this task. Here is the general idea:
I have a string array - websites() - and for each string in this array, I want to add it to the commandlist. Unfortunately, the only way I know of doing this is by writing it one by one, as seen above. I tried doing this:Code:Dim commandlist As New Recognition.SrgsGrammar.SrgsOneOf(websites(0), websites(1), websites(2)) commandRule.Add(commandlist) gram.Rules.Add(commandRule) gram.Root = commandRule recog.LoadGrammar(New Recognition.Grammar(gram))
But this did not work, because I cannot convert strings into srgsoneof... Anyone have any idea how this could be done?Code:Dim commandlist As New Recognition.SrgsGrammar.SrgsOneOf dim i as integer = 0 do until i = websites.items.count commandlist.items.add(websites(i)) i +=1 loop commandRule.Add(commandlist) gram.Rules.Add(commandRule) gram.Root = commandRule recog.LoadGrammar(New Recognition.Grammar(gram))


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks