Class: Google::Apis::CommentanalyzerV1alpha1::CommentAnalyzerService

Inherits:
Google::Apis::Core::BaseService show all
Defined in:
generated/google/apis/commentanalyzer_v1alpha1/service.rb

Overview

Perspective Comment Analyzer API

The Perspective Comment Analyzer API provides information about the potential impact of a comment on a conversation (e.g. it can provide a score for the " toxicity" of a comment). Users can leverage the "SuggestCommentScore" method to submit corrections to improve Perspective over time. Users can set the " doNotStore" flag to ensure that all submitted comments are automatically deleted after scores are returned.

Examples:

require 'google/apis/commentanalyzer_v1alpha1'

Commentanalyzer = Google::Apis::CommentanalyzerV1alpha1 # Alias the module
service = Commentanalyzer::CommentAnalyzerService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Google::Apis::Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Google::Apis::Core::Logging

#logger

Constructor Details

#initializeCommentAnalyzerService

Returns a new instance of CommentAnalyzerService.


50
51
52
53
# File 'generated/google/apis/commentanalyzer_v1alpha1/service.rb', line 50

def initialize
  super('https://commentanalyzer.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.


43
44
45
# File 'generated/google/apis/commentanalyzer_v1alpha1/service.rb', line 43

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.


48
49
50
# File 'generated/google/apis/commentanalyzer_v1alpha1/service.rb', line 48

def quota_user
  @quota_user
end

Instance Method Details

#analyze_comment(analyze_comment_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CommentanalyzerV1alpha1::AnalyzeCommentResponse

Analyzes the provided text and returns scores for requested attributes.

Parameters:

  • analyze_comment_request_object (Google::Apis::CommentanalyzerV1alpha1::AnalyzeCommentRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


74
75
76
77
78
79
80
81
82
83
# File 'generated/google/apis/commentanalyzer_v1alpha1/service.rb', line 74

def analyze_comment(analyze_comment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1alpha1/comments:analyze', options)
  command.request_representation = Google::Apis::CommentanalyzerV1alpha1::AnalyzeCommentRequest::Representation
  command.request_object = analyze_comment_request_object
  command.response_representation = Google::Apis::CommentanalyzerV1alpha1::AnalyzeCommentResponse::Representation
  command.response_class = Google::Apis::CommentanalyzerV1alpha1::AnalyzeCommentResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#suggestscore_comment(suggest_comment_score_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CommentanalyzerV1alpha1::SuggestCommentScoreResponse

Suggest comment scores as training data.

Parameters:

  • suggest_comment_score_request_object (Google::Apis::CommentanalyzerV1alpha1::SuggestCommentScoreRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


104
105
106
107
108
109
110
111
112
113
# File 'generated/google/apis/commentanalyzer_v1alpha1/service.rb', line 104

def suggestscore_comment(suggest_comment_score_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1alpha1/comments:suggestscore', options)
  command.request_representation = Google::Apis::CommentanalyzerV1alpha1::SuggestCommentScoreRequest::Representation
  command.request_object = suggest_comment_score_request_object
  command.response_representation = Google::Apis::CommentanalyzerV1alpha1::SuggestCommentScoreResponse::Representation
  command.response_class = Google::Apis::CommentanalyzerV1alpha1::SuggestCommentScoreResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end