c# - TargetInvocationException when using SemanticResultKey -


i want build grammar accept multiple number. has bug when repeat number saying 'twenty-one'. kept reducing code find problem. reached following piece of code grammar builder:

string[] numberstring = { "one" }; choices numberchoices = new choices();  (int = 0; < numberstring.length; i++) { numberchoices.add(new semanticresultvalue(numberstring[i], numberstring[i])); }  gb[1].append(new semanticresultkey("op1", (grammarbuilder)numberchoices), 1, 2); 

now when pronounce "one one" still gives me exception

enter image description here

which when googled it, states exception outside code, wondering bug in microsoft.speech dll or missing something

edit 1:

i played around code, , made recognition async follow:

sre.recognizeasync(recognizemode.multiple); 

instead of

sre.recognize(); 

now when 'twenty-one'for example gets exception: base = {"duplicated semantic key 'op1' in rule 'root."}

i know problem grammar, did made repeated 'op1'. missing ??

i ended using text recognized parse myself in

void sre_speechrecognized(object sender, speechrecognizedeventargs e) 

i parsed string recognized:

e.result 

instead of

recoresult.semantics["op1"].value.tostring()) 

as .semantics object throws exception mentioned above.

i want know solution, if experienced


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -