2009-02-25 14 views
6

여기에 게시물이 있습니다 ...하지만 저에게는 효과가 없습니다. 인터넷에있는 system.speech.dll을 추가했지만 System.speech를 사용할 수 없습니다. 왜냐하면 나타나지 않기 때문입니다.C# 음성 인식

오류 1 형식 또는 네임 스페이스 이름 'SpeechRecognizer이'을 (를) 찾을 수 없습니다 (당신은 using 지시문 또는 어셈블리 참조가?)

오류 2 형식 또는 네임 스페이스 이름 'SpeechRecognizedEventArgs이'을 (를) 찾을 수 없습니다 (using 지시문이나 어셈블리 참조가 누락 되었습니까?)

이 코드를 사용했습니다. 난 당신이 찾아야했다 안

2) 프로젝트에 System.Speech에 대한 참조를 추가해야 64

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
using SpeechLib; 
using System.Threading; 


namespace WindowsFormsApplication13 
{ 
    public partial class Form1 : Form 
    { 

     SpeechRecognizer rec = new SpeechRecognizer(); 

     public Form1() 
     { 
      InitializeComponent(); 
      rec.SpeechRecognized += rec_SpeechRecognized; 
     } 

     void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) 
     { 
      lblLetter.Text = e.Result.Text; 
     } 


     private void Form1_Load(object sender, EventArgs e) 
     { 
      var c = new Choices(); 

      // Doens't work must use English words to add to Choices and 
      // populate grammar. 
      // 
      //for (var i = 0; i <= 100; i++) 
      // c.Add(i.ToString()); 

      c.Add("one"); 
      c.Add("two"); 
      c.Add("three"); 
      c.Add("four"); 
      c.Add("Five"); 
      c.Add("six"); 
      c.Add("seven"); 
      c.Add("eight"); 
      c.Add("nine"); 
      c.Add("ten"); 

      // etc... 

      var gb = new GrammarBuilder(c); 
      var g = new Grammar(gb); 
      rec.LoadGrammar(g); 
      rec.Enabled = true; 
     } 
    } 
} 

답변

4

1) Windows Vista를 사용하고 'System.Speech.dll'에 인터넷, 그것은 닷넷 3에 있어야합니다 (또는 3.5,하지만 당신이 매력적인 이유를했습니다 않는 어쨌든 3.5을 얻을에)

편집 :

당신은 여기에서 볼 수도 있습니다

:

http://dotnet.org.za/beta/archive/2008/01/06/system-speech-recognition.aspx

+0

감사하지만 지금은 전혀 아무것도하지 않는 프로그램을로드 형태로 디버깅 할 때 나는 또 다른 문제가 . 버튼에 두 번째 코드를 입력하면 프로그램에서 인식자가 설치되지 않는다고합니다. 당신은 이것에서 저를 도울 수 있습니까? –

4

나는 James Ogden에 동의합니다. 또한 "사용"문을 추가해야합니다.

using System.Speech.Recognition 

또는 클래스 이름을 완전히 수식하십시오.

0

위의 질문에 직접적으로 적용 할 수는 없지만 Speech SDK가 각 클라이언트 컴퓨터에서 사용할 수 없다는 점은 주목할 가치가 있습니다. Vista에는 음성 인식기가 포함되어 있지만 XP는 그렇지 않습니다. 이 문제를 해결할 수있는 방법은 XP 사용자에게 Speech SDK를 설치하는 것입니다. 다른 하나는 종속성으로 Office 2003 (2007 아님)을 추가하는 것입니다.

0

Windows XP에서 SpeechRecognizer 클래스에 관한 문제가 있습니다. 때때로 작동하지만 때로는 작동하지 않으며 PC를 다시 시작해야합니다. 윈도우 7에서 잘 작동합니다. 음성 엔진 자체에서 문제가 있다고 생각합니다. 응용 프로그램을 여러 번 실행하면 작동이 멈 춥니 다.

이 코드를 사용하여 :

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; SpeechLib 사용; 시스템을 사용 중입니다.스레딩;

네임 스페이스 WindowsFormsApplication13 { 공공 부분 Form1 클래스 : 양식 {

SpeechRecognizer rec = new SpeechRecognizer(); 

    public Form1() 
    { 
     InitializeComponent(); 
     rec.SpeechRecognized += rec_SpeechRecognized; 
    } 

    void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) 
    { 
     lblLetter.Text = e.Result.Text; 
    } 


    private void Form1_Load(object sender, EventArgs e) 
    { 
     var c = new Choices(); 


     c.Add("one"); 
     c.Add("two"); 
     c.Add("three"); 
     c.Add("four"); 
     c.Add("Five"); 
     c.Add("six"); 
     c.Add("seven"); 
     c.Add("eight"); 
     c.Add("nine"); 
     c.Add("ten"); 

     // etc... 

     var gb = new GrammarBuilder(c); 
     var g = new Grammar(gb); 
     rec.LoadGrammar(g); 
     rec.Enabled = true; 
    } 
} 

}