public ServiceCall<Void> trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions) {
    Validator.notNull(trainLanguageModelOptions, "trainLanguageModelOptions cannot be null");
    String[] pathSegments = { "v1/customizations", "train" };
    String[] pathParameters = { trainLanguageModelOptions.customizationId() };
    RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "trainLanguageModel");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    if (trainLanguageModelOptions.wordTypeToAdd() != null) {
      builder.query("word_type_to_add", trainLanguageModelOptions.wordTypeToAdd());
    }
    if (trainLanguageModelOptions.customizationWeight() != null) {
      builder.query("customization_weight", String.valueOf(trainLanguageModelOptions.customizationWeight()));
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
  }
public ServiceCall < Void > trainLanguageModel ( TrainLanguageModelOptions trainLanguageModelOptions ) { Validator . notNull ( trainLanguageModelOptions , "trainLanguageModelOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" , "train" } ; String [ ] pathParameters = { trainLanguageModelOptions . customizationId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "speech_to_text" , "v1" , "trainLanguageModel" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( trainLanguageModelOptions . wordTypeToAdd ( ) != null ) { builder . query ( "word_type_to_add" , trainLanguageModelOptions . wordTypeToAdd ( ) ) ; } if ( trainLanguageModelOptions . customizationWeight ( ) != null ) { builder . query ( "customization_weight" , String . valueOf ( trainLanguageModelOptions . customizationWeight ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getVoid ( ) ) ; }
Train a custom language model.

Initiates the training of a custom language model with new resources such as corpora, grammars, and custom words.
After adding, modifying, or deleting resources for a custom language model, use this method to begin the actual
training of the model on the latest data. You can specify whether the custom language model is to be trained with
all words from its words resource or only with words that were added or modified by the user directly. You must use
credentials for the instance of the service that owns a model to train it.

The training method is asynchronous. It can take on the order of minutes to complete depending on the amount of
data on which the service is being trained and the current load on the service. The method returns an HTTP 200
response code to indicate that the training process has begun.

You can monitor the status of the training by using the **Get a custom language model** method to poll the model's
status. Use a loop to check the status every 10 seconds. The method returns a `LanguageModel` object that includes
`status` and `progress` fields. A status of `available` means that the custom model is trained and ready to use.
The service cannot accept subsequent training requests or requests to add new resources until the existing request
completes.

Training can fail to start for the following reasons:
* The service is currently handling another request for the custom model, such as another training request or a
request to add a corpus or grammar to the model.
* No training data have been added to the custom model.
* One or more words that were added to the custom model have invalid sounds-like pronunciations that you must fix.

**See also:** [Train the custom language
model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#trainModel-language).

@param trainLanguageModelOptions the {@link TrainLanguageModelOptions} containing the options for the call
@return a {@link ServiceCall} with a response type of Void