c# - speech recogination exception "Cannot find the requested data item, such as a data key or value -
i trying work speech recognition in c#. trying code , gve me exception that
cannot find requested data item, such data key or value
here code using
public partial class form1 : form { speechrecognizer rec = new speechrecognizer(); public form1() { initializecomponent(); rec.speechrecognized += rec_speechrecognized; } private void form1_load(object sender, eventargs e) { messagebox.show(speechrecognitionengine.installedrecognizers().count.tostring()); var c = new choices(); // doens't work must use english words add choices , // populate grammar. // //for (var = 0; <= 100; i++) // c.add(i.tostring()); c.add("one"); c.add("two"); c.add("three"); c.add("four"); c.add("hi"); c.add("hello"); c.add("i"); c.add("a"); c.add("b"); c.add("c"); c.add("d"); c.add("amer"); // etc... var gb = new grammarbuilder(c); var g = new grammar(gb); rec.loadgrammar(g); rec.enabled = true; } void rec_speechrecognized(object sender, speechrecognizedeventargs e) { label1.text = e.result.text; } }
please tell me why exception coming
Comments
Post a Comment