I want my grammar to accept multiple numbers. I have a mistake when I repeat the number, for example, "twenty one." So I kept reducing my code to find the problem. I got the following code snippet for a grammar creator:
string[] numberString = { "one" }; Choices numberChoices = new Choices(); for (int i = 0; i < numberString.Length; i++) { numberChoices.Add(new SemanticResultValue(numberString[i], numberString[i])); } gb[1].Append(new SemanticResultKey("op1", (GrammarBuilder)numberChoices), 1, 2);
Now when I pronounce "one", he still gives me this exception

That when I go to Google for this, it claims that this is an exception outside my code, I wonder if it is a bug in the Microsoft.Speech dll or I am missing something
Change 1:
I played with the code and made Async recognition as follows:
sre.RecognizeAsync(RecognizeMode.Multiple);
instead
sre.Recognize();
now when I say "twenty-one", for example, this is the exception: base = {"Duplicate semantic key 'op1' in the root rule.}}
I know that the problem is related to grammar, but I repeated it for "op1". What am I missing?
Kasparov92
source share