public void Initialize() { Recognizer?.Stop(); _handler = new SpeechTextHandler(); var casts = GetCasts().ToDictionary(x => x.ID); var activators = new List <ActivationWord>(); foreach (var scenId in VoicePluginData.Current.WithoutActivationVoiceScenariosIds) { if (casts.ContainsKey(scenId)) { activators.Add(new SimpleScenarioActivator(casts[scenId])); } } foreach (var keyword in VoicePluginData.Current.Keywords) { activators.Add(new ActivatorWord_StartGoogleRecognition(keyword)); } Recognizer = new GoogleSpeechRecognizer( new Output(_needCasts, _handler), activators.ToArray(), VoicePluginData.Current.ActivationConfidence, VoicePluginData.Current.ExecutionConfidence, VoicePluginData.Current.CaptureDevice); Recognizer.Stopped += (o, e) => ValueChanged?.Invoke(this, ToggleValueType.ValueOFF); }
static void Main(string[] args) { var recognizer = new GoogleSpeechRecognizer(new Output(), new ActivationWord[] { new ActivatorWord_StartGoogleRecognition("окей дом"), new TestActivator("Дом давай спать"), new TestActivator("Дом проснись и пой"), }, 0.65f, 0.7f, Utils.GetCaptureDevices()[0]); recognizer.Start(); while (true) { Console.ReadLine(); recognizer.ActivateManually(); } }