Advertisement
D3NCE

KÜNSTLICHE INTELLIGENZ IN C# SCHREIBEN – PART 17 – DICTATION

Dec 22nd, 2018
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. Video URL: https://www.youtube.com/watch?v=ktmMDZ5dcs4
  2.  
  3. So sollte euer FormLoad() aussehen:
  4.  
  5. private void Form1_Load(object sender, EventArgs e)
  6. {
  7. lbl_time.Text = DateTime.Now.ToShortTimeString();
  8. lbl_date.Text = DateTime.Now.ToLongDateString();
  9.  
  10. tab_control.SelectTab(tab_text);
  11.  
  12. Choices commands = new Choices();
  13. string path = Directory.GetCurrentDirectory() + "\\commands.txt";
  14. commands.Add(File.ReadAllLines(path));
  15.  
  16. GrammarBuilder gbuilder = new GrammarBuilder();
  17. gbuilder.Append(commands);
  18.  
  19. Grammar grammar = new Grammar(gbuilder);
  20. DictationGrammar dgrammar = new DictationGrammar();
  21.  
  22. h.LoadGrammarAsync(dgrammar);
  23.  
  24. h.SetInputToDefaultAudioDevice();
  25. h.SpeechRecognized += recEngine_SpeechRecognized;
  26.  
  27. h.RecognizeAsync(RecognizeMode.Multiple);
  28. s.SelectVoiceByHints(VoiceGender.Female,VoiceAge.Adult);
  29.  
  30. s.SpeakAsync("Wie kann ich dir helfen");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement