【发布时间】:2014-06-27 14:10:19
【问题描述】:
当我对以前注册的医学听写主题使用共享识别器时,听写语法加载没有错误,但是当我将识别器更改为 Inproc 识别器时,它无法加载听写主题。有没有办法在 proc 识别器中使用时加载听写主题?
我的加载语法代码看起来像
CComPtr<ISpObjectToken> cpObjectToken;
CComPtr<ISpAudio> cpAudio;
CComPtr<ISpRecognizer> cpEngine;
CComPtr<ISpRecoContext> cpRecoCtx;
CComPtr<ISpRecoGrammar> cpGram;
hr = cpEngine.CoCreateInstance(CLSID_SpInprocRecognizer);
hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpObjectToken);
hr = cpEngine->SetInput(cpObjectToken, TRUE);
hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &cpAudio);
hr = cpEngine->SetInput(cpAudio, TRUE);
hr = cpEngine->CreateRecoContext(&cpRecoCtx);
hr = cpEngine->SetRecognizer(NULL);
hr = cpRecoCtx->CreateGrammar(1, &cpGram);
hr = cpGram->LoadDictation(L"Medical", SPLO_STATIC);
【问题讨论】:
-
您应该能够使用 inproc 引擎中的主题。你能展示你的代码吗?
-
Inproc 识别器是“shell”。您需要指定识别引擎和输入源。在加载听写主题之前,您可能实际上没有绑定识别引擎,这将失败。
-
我已经添加了我的代码。
标签: windows speech-recognition sapi