Discussion:
CreatePhraseFromText error
(too old to reply)
JV
2012-10-02 10:30:52 UTC
Permalink
Hi,
I'm trying to use CreatePhraseFromText() helper method (to build a phrase to give to EmulateRecognition() ) but it fails. I've ran step by step debugging inside and it seems that it fails in the "hr = cpPhrase->InitFromPhrase(&Phrase);" that returns E_INVALIDARG, inside the CreatePhraseFromWordArray() helper.

Could anybody help in fixing that ? (I use the 10.5 SDK)

Here is my code :

const unsigned int maxCharsCnt = 256;
wchar_t wSpokenText[maxCharsCnt];
mbstowcs(wSpokenText, a_strSpokenText, maxCharsCnt);

ISpPhraseBuilder* pPhrase;
HRESULT hr = CreatePhraseFromText(wSpokenText, &pPhrase, m_WinLanguageID);

hr = m_cpRecognizer->EmulateRecognition(pPhrase);

and when InitFromPhrase() fails, the given SPPHRASE has rule->pNextSibling member to NULL and the cbSize doesn't match with the sizeof(Phrase).
s***@gmail.com
2013-04-26 07:12:01 UTC
Permalink
You have not tried the CreatePhraseFromText function but how does it work?
Loading...