def add_corpus(customization_id:, corpus_name:, corpus_file:, allow_overwrite: nil)
      raise ArgumentError.new("customization_id must be provided") if customization_id.nil?

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

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

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

      params = {
        "allow_overwrite" => allow_overwrite
      }

      form_data = {}

      unless corpus_file.instance_of?(StringIO) || corpus_file.instance_of?(File)
        corpus_file = corpus_file.respond_to?(:to_json) ? StringIO.new(corpus_file.to_json) : StringIO.new(corpus_file)
      end
      form_data[:corpus_file] = HTTP::FormData::File.new(corpus_file, content_type: "text/plain", filename: corpus_file.respond_to?(:path) ? corpus_file.path : nil)

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

      request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      nil
    end
def add_corpus(customization_id:, corpus_name:, corpus_file:, allow_overwrite: nil)
      raise ArgumentError.new("customization_id must be provided") if customization_id.nil?

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

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

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

      params = {
        "allow_overwrite" => allow_overwrite
      }

      form_data = {}

      unless corpus_file.instance_of?(StringIO) || corpus_file.instance_of?(File)
        corpus_file = corpus_file.respond_to?(:to_json) ? StringIO.new(corpus_file.to_json) : StringIO.new(corpus_file)
      end
      form_data[:corpus_file] = HTTP::FormData::File.new(corpus_file, content_type: "text/plain", filename: corpus_file.respond_to?(:path) ? corpus_file.path : nil)

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

      request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      nil
    end
Custom corpora


 @!method add_corpus(customization_id:, corpus_name:, corpus_file:, allow_overwrite: nil)
 Add a corpus.
 Adds a single corpus text file of new training data to a custom language model.
   Use multiple requests to submit multiple corpus text files. You must use
   credentials for the instance of the service that owns a model to add a corpus to
   it. Adding a corpus does not affect the custom language model until you train the
   model for the new data by using the **Train a custom language model** method.

   Submit a plain text file that contains sample sentences from the domain of
   interest to enable the service to extract words in context. The more sentences you
   add that represent the context in which speakers use words from the domain, the
   better the service's recognition accuracy.

   The call returns an HTTP 201 response code if the corpus is valid. The service
   then asynchronously processes the contents of the corpus and automatically
   extracts new words that it finds. This can take on the order of a minute or two to
   complete depending on the total number of words and the number of new words in the
   corpus, as well as the current load on the service. You cannot submit requests to
   add additional resources to the custom model or to train the model until the
   service's analysis of the corpus for the current request completes. Use the **List
   a corpus** method to check the status of the analysis.

   The service auto-populates the model's words resource with words from the corpus
   that are not found in its base vocabulary. These are referred to as
   out-of-vocabulary (OOV) words. You can use the **List custom words** method to
   examine the words resource. You can use other words method to eliminate typos and
   modify how words are pronounced as needed.

   To add a corpus file that has the same name as an existing corpus, set the
   `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting
   an existing corpus causes the service to process the corpus text file and extract
   OOV words anew. Before doing so, it removes any OOV words associated with the
   existing corpus from the model's words resource unless they were also added by
   another corpus or grammar, or they have been modified in some way with the **Add
   custom words** or **Add a custom word** method.

   The service limits the overall amount of data that you can add to a custom model
   to a maximum of 10 million total words from all sources combined. Also, you can
   add no more than 30 thousand custom (OOV) words to a model. This includes words
   that the service extracts from corpora and grammars, and words that you add
   directly.

   **See also:**
   * [Working with
   corpora](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingCorpora)
   * [Add corpora to the custom language
   model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addCorpora).
 @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 corpus_name [String] The name of the new corpus for the custom language model. Use a localized name
   that matches the language of the custom model and reflects the contents of the
   corpus.
   * Include a maximum of 128 characters in the name.
   * Do not include spaces, slashes, or backslashes in the name.
   * Do not use the name of an existing corpus or grammar that is already defined for
   the custom model.
   * Do not use the name `user`, which is reserved by the service to denote custom
   words that are added or modified by the user.
 @param corpus_file [File] A plain text file that contains the training data for the corpus. Encode the file
   in UTF-8 if it contains non-ASCII characters; the service assumes UTF-8 encoding
   if it encounters non-ASCII characters.

   Make sure that you know the character encoding of the file. You must use that
   encoding when working with the words in the custom language model. For more
   information, see [Character
   encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).


   With the `curl` command, use the `--data-binary` option to upload the file for the
   request.
 @param allow_overwrite [Boolean] If `true`, the specified corpus overwrites an existing corpus with the same name.
   If `false`, the request fails if a corpus with the same name already exists. The
   parameter has no effect if a corpus with the same name does not already exist.
 @return [nil]