class Copyleaks::NaturalLanguageSubmissionModel

Attributes

language[RW]

Public Class Methods

new(text, language = nil, sandbox = false) click to toggle source

@param [String] A text string. @param [String] The language code of your content. The selected language should be on the Supported Languages list above. If the ‘language’ field is not supplied , our system will automatically detect the language of the content. @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.

# File lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb, line 32
def initialize(text, language = nil, sandbox = false)
  unless text.instance_of?(String)
    raise 'Copyleaks::NaturalLanguageSubmissionModel - text - text must be of type String'
  end
  super(text, sandbox)
  @language = language
end

Public Instance Methods

as_json(*_args) click to toggle source
# File lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb, line 40
def as_json(*_args)
  {
    text: @text,
    sandbox: @sandbox,
    language: @language
  }.select { |_k, v| !v.nil? }
end
to_json(*options) click to toggle source
# File lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb, line 48
def to_json(*options)
  as_json(*options).to_json(*options)
end