Search code examples
windowsvisual-c++speech-recognitionsapi

How to make a dictation grammar which accepts medical terms?


I am using sapi 5.4 and my grammar file contains

 <RULE ID="VID_InputType">
     <L PROPID="VID_InputType">
       <DICTATION MAX="INF"/>
     </L>
 </RULE> 

But also I know that dictation will contain only medical terms is there a way to specify that in grammar file?


Solution

  • You don't specify the dictation topic in the grammar; you do it in code.

    But to do that, you need a medical dictation grammar. Trigram Technology sells one, but it's expensive. Once you purchase and install it, the documentation will describe the dictation topic.

    Once you have that, the code is pretty simple:

    ISpRecoGrammar pGrammar; // assumes already created
    HRESULT hr = _cpGrammar->LoadDictation( topic, SPLO_STATIC ); // topic defined by Trigram
    if (SUCCEEDED(hr))
    {
        hr = _cpGrammar->SetDictationState(SPRS_ACTIVE);
    }