class CloudmersiveNlpApiClient::AnalyticsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

analytics_hate_speech(input, opts = {}) click to toggle source

Perform Hate Speech Analysis and Detection on Text Analyze input text using advanced Hate Speech Analysis to determine if the input contains hate speech language. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input hate speech analysis request @param [Hash] opts the optional parameters @return [HateSpeechAnalysisResponse]

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 27
def analytics_hate_speech(input, opts = {})
  data, _status_code, _headers = analytics_hate_speech_with_http_info(input, opts)
  data
end
analytics_hate_speech_with_http_info(input, opts = {}) click to toggle source

Perform Hate Speech Analysis and Detection on Text Analyze input text using advanced Hate Speech Analysis to determine if the input contains hate speech language. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input hate speech analysis request @param [Hash] opts the optional parameters @return [Array<(HateSpeechAnalysisResponse, Fixnum, Hash)>] HateSpeechAnalysisResponse data, response status code and response headers

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 37
def analytics_hate_speech_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.analytics_hate_speech ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_hate_speech"
  end
  # resource path
  local_var_path = '/nlp-v2/analytics/hate-speech'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'HateSpeechAnalysisResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#analytics_hate_speech\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
analytics_profanity(input, opts = {}) click to toggle source

Perform Profanity and Obscene Language Analysis and Detection on Text Analyze input text using advanced Profanity and Obscene Language Analysis to determine if the input contains profane language. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input profanity analysis request @param [Hash] opts the optional parameters @return [ProfanityAnalysisResponse]

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 81
def analytics_profanity(input, opts = {})
  data, _status_code, _headers = analytics_profanity_with_http_info(input, opts)
  data
end
analytics_profanity_with_http_info(input, opts = {}) click to toggle source

Perform Profanity and Obscene Language Analysis and Detection on Text Analyze input text using advanced Profanity and Obscene Language Analysis to determine if the input contains profane language. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input profanity analysis request @param [Hash] opts the optional parameters @return [Array<(ProfanityAnalysisResponse, Fixnum, Hash)>] ProfanityAnalysisResponse data, response status code and response headers

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 91
def analytics_profanity_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.analytics_profanity ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_profanity"
  end
  # resource path
  local_var_path = '/nlp-v2/analytics/profanity'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ProfanityAnalysisResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#analytics_profanity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
analytics_sentiment(input, opts = {}) click to toggle source

Perform Sentiment Analysis and Classification on Text Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input sentiment analysis request @param [Hash] opts the optional parameters @return [SentimentAnalysisResponse]

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 135
def analytics_sentiment(input, opts = {})
  data, _status_code, _headers = analytics_sentiment_with_http_info(input, opts)
  data
end
analytics_sentiment_with_http_info(input, opts = {}) click to toggle source

Perform Sentiment Analysis and Classification on Text Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input sentiment analysis request @param [Hash] opts the optional parameters @return [Array<(SentimentAnalysisResponse, Fixnum, Hash)>] SentimentAnalysisResponse data, response status code and response headers

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 145
def analytics_sentiment_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.analytics_sentiment ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_sentiment"
  end
  # resource path
  local_var_path = '/nlp-v2/analytics/sentiment'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SentimentAnalysisResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#analytics_sentiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
analytics_similarity(input, opts = {}) click to toggle source

Perform Semantic Similarity Comparison of Two Strings Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence. @param input Input similarity analysis request @param [Hash] opts the optional parameters @return [SimilarityAnalysisResponse]

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 189
def analytics_similarity(input, opts = {})
  data, _status_code, _headers = analytics_similarity_with_http_info(input, opts)
  data
end
analytics_similarity_with_http_info(input, opts = {}) click to toggle source

Perform Semantic Similarity Comparison of Two Strings Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence. @param input Input similarity analysis request @param [Hash] opts the optional parameters @return [Array<(SimilarityAnalysisResponse, Fixnum, Hash)>] SimilarityAnalysisResponse data, response status code and response headers

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 199
def analytics_similarity_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.analytics_similarity ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_similarity"
  end
  # resource path
  local_var_path = '/nlp-v2/analytics/similarity'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SimilarityAnalysisResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#analytics_similarity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
analytics_subjectivity(input, opts = {}) click to toggle source

Perform Subjectivity and Objectivity Analysis on Text Analyze input text using advanced Subjectivity and Objectivity Language Analysis to determine if the input text is objective or subjective, and how much. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input subjectivity analysis request @param [Hash] opts the optional parameters @return [SubjectivityAnalysisResponse]

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 243
def analytics_subjectivity(input, opts = {})
  data, _status_code, _headers = analytics_subjectivity_with_http_info(input, opts)
  data
end
analytics_subjectivity_with_http_info(input, opts = {}) click to toggle source

Perform Subjectivity and Objectivity Analysis on Text Analyze input text using advanced Subjectivity and Objectivity Language Analysis to determine if the input text is objective or subjective, and how much. Supports English language input. Consumes 1-2 API calls per sentence. @param input Input subjectivity analysis request @param [Hash] opts the optional parameters @return [Array<(SubjectivityAnalysisResponse, Fixnum, Hash)>] SubjectivityAnalysisResponse data, response status code and response headers

# File lib/cloudmersive-nlp-api-client/api/analytics_api.rb, line 253
def analytics_subjectivity_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.analytics_subjectivity ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_subjectivity"
  end
  # resource path
  local_var_path = '/nlp-v2/analytics/subjectivity'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SubjectivityAnalysisResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#analytics_subjectivity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end