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, refer to the Media Server Administration Guide. No
textdata The text to use for training. Text files must be uploaded as multipart/form-data. For more information about sending data to Media Server, refer to the Media Server Administration Guide. 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. 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.