2011-02-01 16 views
10

मैं ऐसे सॉफ्टवेयर का निर्माण करने की कोशिश कर रहा हूं जो विभिन्न पाठ आदेशों का अर्थ है, सभी एक कस्टम तरीके से। मैं System.Speech.Recognition का उपयोग करता हूं और यह आश्चर्यजनक रूप से अच्छी तरह से काम करता है, लेकिन मुझे यह नहीं पता कि इस तथ्य को कैसे प्राप्त किया जाए कि जब भी मैं "हटाएं", "बंद करें", "सही", आदि डिफ़ॉल्ट रूप से समाप्त करूंगा विंडोज़ (7) कार्यान्वयन। क्या System.Speech.Recognition के साथ इसके आसपास जाने का कोई तरीका है? यदि नहीं, तो कौन सी सी # .NET लाइब्रेरी आपको सबसे अधिक अनुशंसा करेगी?अंतर्निहित भाषण मान्यता आदेश अक्षम करें?

उत्तर

12

SpeechRecognizer के बजाय SpeechRecognitionEngine का उपयोग करें।
इस प्रयास करें:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Speech.Recognition; 
namespace speech 
{ 
class Program 
{ 
    static void Main(string[] args) 
    { 
     SpeechRecognitionEngine mynizer = new SpeechRecognitionEngine(); 

     GrammarBuilder builder = new GrammarBuilder(); 
     builder.AppendDictation(); 
     Grammar mygram = new Grammar(builder); 
     mynizer.SetInputToDefaultAudioDevice(); 
     mynizer.LoadGrammar(mygram); 
     while (true) 
     { 
      Console.WriteLine(mynizer.Recognize().Text); 
     } 
    } 

} 
} 
+0

बिल्कुल सही! धन्यवाद। – Lazlo

संबंधित मुद्दे