Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi, I am having a problem in my project here, i want to save the name of the person when the computer ask for its name! to text file in c:\.
can you please guide me on this, if i need to create a separate grammar for the names.
Thanks
namespace mypro
{
    public partial class MainWindow : Window
    {
        SpeechRecognitionEngine en = new SpeechRecognitionEngine();
 
        public MainWindow()
        {
            InitializeComponent();
 
            en.SetInputToDefaultAudioDevice();
 
            Choices ch = new Choices("Hello","hey");
            Grammar h = new Grammar(ch.ToGrammarBuilder());
            h.Name = "ha";
 
   en.LoadGrammarAsync(h);
 
   en.RecognizeAsync(RecognizeMode.Multiple);
 
  en.SpeechRecognized += new EventHandler<Speech Recognized EventArgs>(en_SpeechRecognized)
            
        }
 

public void en_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            if (e.Result.Grammar.Name == "ha")
            {
                switch (e.Result.Text)
                {
                         
                    case "Hello":
                        Say("hi, may i know your name?");
                         break;
                    case "hey":
                         Say("hi, may i know your name?");
                        break;
                }
            }
        }
 
    public void Say(string input)
        {
            var s = new SpeechSynthesizer();
            var sa = new Prompt(input);
            s.Speak(sa);
            
        }
 
       
    }
}
           
Posted 16-Apr-13 22:39pm
Edited 18-Apr-13 10:12am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you follow this thread youll find your answer:
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/97c58d33-d9d5-4a2c-867f-90019cdfff77/[^]
 
It also depends on what language you are thinking of using though.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

recongition system will only recognize those words which are already in the grammar file
means you can not directly add names to the grammar files
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Nope , none of above solutions helped me! Anybody else has anything to add. please help me find a solution.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Jochen Arndt 165
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100