Important: The information in this document is obsolete and should not be used for new development.
Saving and Loading Language Objects
The Speech Recognition Manager provides several functions that you can use to put a language object into the data or resource fork of a file and to load a saved language object from a file. For example, you can save a language model in a resource by calling theSRPutLanguageObjectIntoHandle
function. This function creates a description of the language model and puts it into a block of memory you've already allocated, resizing the handle as necessary and overwriting any existing contents. You callSRPutLanguageObjectIntoHandle
like this:
myErr = SRPutLanguageObjectIntoHandle(myLModel, myHandle);IfSRPutLanguageObjectIntoHandle
returns successfully, you can then use standard Resource Manager routines (for example,AddResource
) to add the data in the handle to a file's resource fork. The resource type and ID of the new resource are specified by your application.You can read a saved language object from a resource by loading the resource using Resource Manager functions (for example,
GetResource
) and then converting the resource data into a language object by calling theSRNewLanguageObjectFromHandle
function, like this:
myErr = SRNewLanguageObjectFromHandle(mySys, myLModel, myHandle);The format of the language object data stored in a handle (or data file) is private. You should always use the supplied Speech Recognition Manager functions to read and write language object data.