Media Server 25.1
Media Server Help

# TrainCustomSpeechLanguageModel

Trains a new custom language model.

Type: asynchronous

Parameter | Description | Required
--- | --- | ---
`identifier` | A unique identifier for the new custom language model. If you do not set this parameter, Media Server generates an identifier automatically. NOTE: If you specify an identifier that already exists, Media Server overwrites the existing custom language model. To add training to an existing language model, you must send the existing text and the new text. | No
`languagePack` | The language pack to base the custom language model on. You cannot train a custom language model with one language and use it with another, so this parameter and the LanguagePack parameter in your speech-to-text task must have the same value. | Yes
`normalize` | A Boolean value (default true) that specifies whether to normalize the text. This is not supported for all languages. If normalization is not supported you must normalize the text manually. For more information about training custom language models, see Custom Language Models. | No
`textdata` | The text to use for training. Send files to Media Server using a multipart/form-data HTTP POST request. | Set this or `textpath`
`textpath` | A comma-separated list of paths to the text files that contain the text to use for training. The paths must be absolute, or relative to the Media Server executable file. To strengthen security, Media Server can be configured to read files only from specified directories. For information about the directories that Media Server is permitted to read from, see the parameter AllowedInputDirectories. | Set this or `textdata`

## Example

The following example trains Media Server by sending the paths of files that contain the training text. The paths must be absolute, or relative to the Media Server executable file:

    curl http://localhost:14000 -F action=TrainCustomSpeechLanguageModel
                                -F identifier=MedicalTerms
                                -F languagepack=ENUK
                                -F textpath=one.txt,two.txt

Alternatively, you can train Media Server by sending the data, for example:

    curl http://localhost:14000/action=TrainCustomSpeechLanguageModel
                                -F identifier=MedicalTerms
                                -F languagepack=ENUK
                                -F textdata=@one.txt,two.txt

## Response

This action is asynchronous, so Media Server always returns success accompanied by a token. You can use this token with the QueueInfo action to retrieve the status of your request.

The following XML is a response from the `QueueInfo` action.

    <autnresponse>
      <action>QUEUEINFO</action>
      <response>SUCCESS</response>
      <responsedata>
        <actions>
          <action>
            <status>Finished</status>
            <queued_time>2018-May-02 06:37:07</queued_time>
            <time_in_queue>1</time_in_queue>
            <process_start_time>2018-May-02 06:37:08</process_start_time>
            <time_processing>5</time_processing>
            <process_end_time>2018-May-02 06:37:13</process_end_time>
            <identifier>MedicalTerms</identifier>
            <languagePack>ENUK</languagePack>
            <recommendedWeight>0.05</recommendedWeight>
            <token>...</token>
            <totalWords>2529</totalWords>
            <uniqueWords>929</uniqueWords>
          </action>
        </actions>
      </responsedata>
    </autnresponse>

The response includes the following elements:

- `totalWords` - the number of words supplied in the training text.
- `uniqueWords` - the number of unique words supplied in the training text (the size of the vocabulary).
- `recommendedWeight` - suggests the interpolation weight to use when you set the CustomLanguageModel parameter in your speech-to-text task.

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Media Server 25.1

Topic Title: TrainCustomSpeechLanguageModel