lib/ibm_watson/natural_language_classifier_v1.rb
def create_classifier(metadata:, training_data:)
      raise ArgumentError.new("metadata must be provided") if metadata.nil?

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

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

      form_data = {}

      unless metadata.instance_of?(StringIO) || metadata.instance_of?(File)
        metadata = metadata.respond_to?(:to_json) ? StringIO.new(metadata.to_json) : StringIO.new(metadata)
      end
      form_data[:training_metadata] = HTTP::FormData::File.new(metadata, content_type: "application/json", filename: metadata.respond_to?(:path) ? metadata.path : nil)

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

      method_url = "/v1/classifiers"

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        form: form_data,
        accept_json: true
      )
      response
    end
def create_classifier(metadata:, training_data:)
      raise ArgumentError.new("metadata must be provided") if metadata.nil?

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

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

      form_data = {}

      unless metadata.instance_of?(StringIO) || metadata.instance_of?(File)
        metadata = metadata.respond_to?(:to_json) ? StringIO.new(metadata.to_json) : StringIO.new(metadata)
      end
      form_data[:training_metadata] = HTTP::FormData::File.new(metadata, content_type: "application/json", filename: metadata.respond_to?(:path) ? metadata.path : nil)

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

      method_url = "/v1/classifiers"

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        form: form_data,
        accept_json: true
      )
      response
    end
Manage classifiers


 @!method create_classifier(metadata:, training_data:)
 Create classifier.
 Sends data to create and train a classifier and returns information about the new
   classifier.
 @param metadata [File] Metadata in JSON format. The metadata identifies the language of the data, and an
   optional name to identify the classifier. Specify the language with the 2-letter
   primary language code as assigned in ISO standard 639.

   Supported languages are English (`en`), Arabic (`ar`), French (`fr`), German,
   (`de`), Italian (`it`), Japanese (`ja`), Korean (`ko`), Brazilian Portuguese
   (`pt`), and Spanish (`es`).
 @param training_data [File] Training data in CSV format. Each text value must have at least one class. The
   data can include up to 3,000 classes and 20,000 records. For details, see [Data
   preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html).
 @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.