Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
http://chupanhcuoi.com.vn/temp/Untitled.png
I have this small test application(sorry because the source code is copied from other and edited by me), which can recognize word from the words in the first textbox. the program works perfect with some words, but with somes, it never works. For a sample, my input is "one two three car book" (there are five words contained in the grammar). And the program can recognize 1,2,3 easily, but I can never make it recognize car, and book.

Any one can help me explain why ? Or is there any solution which can force to train the speech recognizer the word "car" and "book" programmatically ?

Sorry for my English, I'm not a native speaker.

Here is my project zip file : http://chupanhcuoi.com.vn/temp/SpeechTest.zip[^]

Sorry that I dont know how to upload to codeproject.com
the code for speech recognizer is from line 211 to line 256.

C#
private void cmdEnable_Click(object sender, System.EventArgs e)//button to start recognizer
{
    if (xpmode)
    {
//ignore this because these code is for window xp

    }
    else
    {
        if (!recInited)
        {
//if the button is click the first time, init variables 
            recognizer = new SpeechRecognitionEngine();
            recognizer.SetInputToDefaultAudioDevice();
            recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
        }
        else
        {
            if (recognizer != null)
            {
//stop the old recognizer for new grammars defined in the textbox
                recognizer.RecognizeAsyncStop();
            }
        }
        changerecDict();
        recognizer.RecognizeAsync(RecognizeMode.Multiple);//TurnSpeechRecognitionOn
        recInited = true;
    }
}
void changerecDict()
{
    recogniseDict = grammartext.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    if (xpmode)
    {
    }
    else
    {
        recognizer.UnloadAllGrammars();
        recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(recogniseDict)))); //[string] contains {"one","two","three","car","book"
    }
}
//event 4 xp
private void Reco_Event(int StreamNumber, object StreamPosition,SpeechRecognitionType RecognitionType,ISpeechRecoResult Result)
{
//ignore
}
//event 4 7
private void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
    txtReco.Text = e.Result.Text + " " + e.Result.Confidence;
}
Posted
Updated 13-Jun-11 17:44pm
v4

1 solution

I don't think you can blame your code for that problem. This is the level of technology and… you pronunciation.

Is it English? Even I often misunderstand some words pronounced in English by people from Vietnam. At the same time, many native English speakers (I'm not) usually understand them better then I do. Speech recognition technology needs a long way to grow to this level. :-)

[EDIT]
Your code failed to build, so I could not test it (VS 2008, 2010). Why do you use SpeechLib? All you need is System.Speech. I know what I say because I have done such applications — they do not work well is commands are spoken with strong accent. I also have quite noticeable accent but my applications deal well with it if the grammar is reasonably small and there are no very similar commands.

Please don't post your responses as solution. Use "Improve question", "Add comment" or reply to other comments.

—SA
 
Share this answer
 
v2
Comments
bean2604 14-Jun-11 2:08am    
ah, sorry I because this is kind of test app, so there are somethings unused. My app is written to work with sapi 5.1 in windows XP as well(so many people are still using XP), and the built in sapi of vista/7, that why there is Speechlib in the references, but I don't ask about windows XP (I only have virtual XP and it doesn't work with sapi 5.1 so now I can't test with XP), so anything related to windows xp, you can delete them, include variable used in "if(xpmode) ....". But, if you use windows XP, you can not find my problem, thanks for reading !
All I install in windows 7 is vs 2005, no more special libraries for my app.
Although I read many articles on codeproject before, but this is the first time I write something, so I make many mistakes.
bean2604 14-Jun-11 2:31am    
I just find out 1 solution, is to use "train your computer to better understand you". but this is a manual way to train the computer --> so I don't want to add it as a solution, and that is not usable for some people such as a child, or some low skilled speaker (we have to speak many long sentences in the training progress). I want to make a program which easy to use. Any idea to make it automatic train when I using the application, with some indicated word ? I google this many times, but I can't find the solution.
Sergey Alexandrovich Kryukov 14-Jun-11 16:38pm    
I'm familiar with training, but not for the Microsoft speech recognition engine(s). Could you post this solution? Many would be interested to see.
--SA
bean2604 16-Jun-11 4:19am    
May be you misunderstand me, sorry for making you be disappointed! I told I have a solution but that is only a function of windows vista/7 in controlpanel, not something I programmed. I really want to make the training function to be automatic with some predefined words and associated .wav/.mp3 file to train the computer to understand that wave stream as a standard voice. But I can't find any way to do that on google.
I don't know anything which does not related to Microsoft speech recognition engine because voice recognition is a very complicated field to me, as I need to have good knowledge in Math, Bio, Phys, and even IT as well.
Any way, I found some files stored in C:\Users\phuong\AppData\Local\Microsoft\Speech\Files\TrainingAudio, which are all my voice recorded when I train the program, but with the random name link this :SP_7183E8616ADF488790DC43C1FFB6B5A8.wav
So I think I cant copy my trained data to the other computer (some computer which is never trained can hardly to recognize a word)
Sergey Alexandrovich Kryukov 17-Jun-11 4:17am    
Oh now, I'm not disappointed. Just the opposite: I never heard of training in speech recognition by Microsoft, would like to know. Is is possible to train? You're showing some local directory which I don't have. Where to get some information?
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900