lib/ibm_watson/speech_to_text_v1.rb
def add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
      raise ArgumentError.new("customization_id must be provided") if customization_id.nil?

      raise ArgumentError.new("word_name must be provided") if word_name.nil?

      headers = {
      }
      sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "add_word")
      headers.merge!(sdk_headers)

      data = {
        "word" => word,
        "sounds_like" => sounds_like,
        "display_as" => display_as
      }

      method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]

      request(
        method: "PUT",
        url: method_url,
        headers: headers,
        json: data,
        accept_json: true
      )
      nil
    end
def add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
      raise ArgumentError.new("customization_id must be provided") if customization_id.nil?

      raise ArgumentError.new("word_name must be provided") if word_name.nil?

      headers = {
      }
      sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "add_word")
      headers.merge!(sdk_headers)

      data = {
        "word" => word,
        "sounds_like" => sounds_like,
        "display_as" => display_as
      }

      method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]

      request(
        method: "PUT",
        url: method_url,
        headers: headers,
        json: data,
        accept_json: true
      )
      nil
    end
Custom words


 @!method add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
 Add a custom word.
 Adds a custom word to a custom language model. The service populates the words
   resource for a custom model with out-of-vocabulary (OOV) words from each corpus or
   grammar that is added to the model. You can use this method to add a word or to
   modify an existing word in the words resource. The words resource for a model can
   contain a maximum of 30 thousand custom (OOV) words. This includes words that the
   service extracts from corpora and grammars and words that you add directly.

   You must use credentials for the instance of the service that owns a model to add
   or modify a custom word for the model. Adding or modifying a custom word does not
   affect the custom model until you train the model for the new data by using the
   **Train a custom language model** method.

   Use the `word_name` parameter to specify the custom word that is to be added or
   modified. Use the `CustomWord` object to provide one or both of the optional
   `sounds_like` and `display_as` fields for the word.
   * The `sounds_like` field provides an array of one or more pronunciations for the
   word. Use the parameter to specify how the word can be pronounced by users. Use
   the parameter for words that are difficult to pronounce, foreign words, acronyms,
   and so on. For example, you might specify that the word `IEEE` can sound like `i
   triple e`. You can specify a maximum of five sounds-like pronunciations for a
   word.
   * The `display_as` field provides a different way of spelling the word in a
   transcript. Use the parameter when you want the word to appear different from its
   usual representation or from its spelling in training data. For example, you might
   indicate that the word `IBM(trademark)` is to be displayed as `IBM&trade;`.

   If you add a custom word that already exists in the words resource for the custom
   model, the new definition overwrites the existing data for the word. If the
   service encounters an error, it does not add the word to the words resource. Use
   the **List a custom word** method to review the word that you add.

   **See also:**
   * [Working with custom
   words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
   * [Add words to the custom language
   model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).
 @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
   the request. You must make the request with credentials for the instance of the
   service that owns the custom model.
 @param word_name [String] The custom word that is to be added to or updated in the custom language model. Do
   not include spaces in the word. Use a `-` (dash) or `_` (underscore) to connect
   the tokens of compound words. URL-encode the word if it includes non-ASCII
   characters. For more information, see [Character
   encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
 @param word [String] For the **Add custom words** method, you must specify the custom word that is to
   be added to or updated in the custom model. Do not include spaces in the word. Use
   a `-` (dash) or `_` (underscore) to connect the tokens of compound words.

   Omit this parameter for the **Add a custom word** method.
 @param sounds_like [Array[String]] An array of sounds-like pronunciations for the custom word. Specify how words that
   are difficult to pronounce, foreign words, acronyms, and so on can be pronounced
   by users.
   * For a word that is not in the service's base vocabulary, omit the parameter to
   have the service automatically generate a sounds-like pronunciation for the word.
   * For a word that is in the service's base vocabulary, use the parameter to
   specify additional pronunciations for the word. You cannot override the default
   pronunciation of a word; pronunciations you add augment the pronunciation from the
   base vocabulary.

   A word can have at most five sounds-like pronunciations. A pronunciation can
   include at most 40 characters not including spaces.
 @param display_as [String] An alternative spelling for the custom word when it appears in a transcript. Use
   the parameter when you want the word to have a spelling that is different from its
   usual representation or from its spelling in corpora training data.
 @return [nil]