CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


The Microsoft.com Speech website Microsoft Speech SDK

SAPI 5.1

ISpRecoContext::SetAdaptationData

ISpRecoContext::SetAdaptationData passes a block of text to the SR engine which can be used to adapt the active language models.

HRESULT SetAdaptationData(
   const WCHAR   *pAdaptationData,
   const ULONG    cch
);

Parameters

pAdaptationData
[in] The string to adapt.
cch
[in] The number of characters in pAdaptationData.

Return values

Value Description
S_OK Function completed successfully.
E_INVALIDARG pAdaptationData is invalid or cch equals zero.
E_OUTOFMEMORY Exceeded available memory.
SPERR_SR_ENGINE_EXCEPTION An exception was thrown by the SR engine during ISpSREngine::SetAdaptationData.
FAILED(hr) Appropriate error message.

Remarks

An application can improve recognition accuracy for dictating uncommon words, or uncommon word groupings, by training the SR engine for the new words, or word groupings, by creating or obtaining typical text and send the results to the engine using ::SetAdaptationData.

For example, a word processing application train the engine on previously created text documents. Similarly, an e-mail or collaboration application could train the SR engine on previously sent e-mail or collaborated documents. After training, the SR engine could perform better within specific domains of information, and improve the application's and SAPI's personalization experience.

The SAPI middleware component (and Microsoft) do not store this information - instead it is passed directly to the SR engine using ISpSREngine::SetAdaptationData. The SR engine (vendor) determines what to do with the string data, including how the data is persisted and for how long. Some SR engines may require a significant amount of time to process the string data, so the application may want to break up the data in smaller chunks to send individually.

Applications that use SetAdaptationData should break the data into small (1K or less) blocks, call SetAdaptationData, and then wait for an SPEI_ADAPTATION event before sending the next small block of data. This method should not be used with large buffers, because calling SetAdapataionData with buffers larger than 32K can cause unpredictable results.

When the SR engine is ready to receive more string data to adapt its language model, it can fire the SPEI_ADAPTATION event to the application.

Example

The following code snippet illustrates the use of ISpRecoContext::SetAdaptationData

    HRESULT hr = S_OK;

    // get the "training" data, and break it into manageable chunks [e.g. an array of strings]
    // ...

    // set interest in the adaptation event
    hr = cpRecoContext->SetInterest(SPFEI(SPEI_ADAPTATION), SPFEI(SPEI_ADAPTATION));
    // Check hr

    // adapt to each chunk of data
    for (int i = 0; i < iCountOfDataChunk; i ++)
    {
       // send each chunk of data the engine
       hr = cpRecoContext->SetAdaptationData(ppwszAdaptationData[i], wcslen(ppwszAdaptationData[i]));
       // Check hr

       // wait for the engine to ask for more data
       hr = cpRecoContext->WaitForNotifyEvent(PROCESSING_WAIT_TIME);
       // Check hr
    }

    // SR Engine has adapted its language model to data


You are reading help file online using chmlib.com

If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web