0

音声認識エンジンを使用するアプリケーションを作成する必要があります。アプリの目的は、PC (キーボードとマウス) を制御することです。ユーザーが「open mycomputer」と言ってコンピューターを開くか、そのアクションを実行するために何かを言うと、多くの時間を試しましたが、途中で立ち往生しました。
私のコードは

       {         
        SpeechRecognizer recognizer = new SpeechRecognizer();
        recognizer.Enabled = true;

        Choices folderPath= new Choices();
        folderPath.Add(new string[] { "My Computer", "My Documents", "my docs", "Sumeet", "gehi"});

        GrammarBuilder gb = new GrammarBuilder(folderPath);

        Grammar gramer = new Grammar(gb);
        recognizer.LoadGrammar(gramer);

        gramerSpeechRecognized+=new EventHandler<SpeechRecognizedEventArgs (gramer_SpeechRecognized);
    }
    void gramer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {

        if (e.Result.Text == "computer" || e.Result.Text=="my computer")
        {
           string myComputerPath = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
        System.Diagnostics.Process.Start("explorer", myComputerPath);
      //OR
        //System.Diagnostics.Process.Start("explorer", "::{20d04fe0-3aea-1069-a2d8-08002b30309d}");
        }
        else
        {
           // give output what user have said
          textBox1.Text = e.Result.Text;
         }
    }

助けが必要!!!何をすべきか、または私のコードに誤りがありますか???

4

1 に答える 1