问题
I m developing an c# project based on voice recognition. I want to recognize words in Indian English accent so for that i thought for lexicon & then adding pronunciations in that file but I m not getting how to add a lexicon in my project & how to create a lexicon?
回答1:
Lexicons aren't exposed via System.Speech.Recognition, unfortunately. You can access lexicons using the SpeechLib automation interface to SAPI, though; the object you want to create is SpLexicon.
Note that System.Speech.Recognition will automatically load any user lexicons, so you can have a separate app to build the lexicon and your reco app can continue to use System.Speech.Recognition.
Also, if you're using a command & control grammar, you should specify pronunciations directly; for example, the SrgsToken class allows you to explicitly specify a pronunciation for the word. (Unfortunately, I can't remember how to do this with System.Speech.Recognition.GrammarBuilder
, but it is possible.)
来源:https://stackoverflow.com/questions/21313934/how-to-add-a-custom-lexicon-in-my-c-project