Class: Google::Apis::LanguageV2::CloudNaturalLanguageService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::LanguageV2::CloudNaturalLanguageService
- Defined in:
- lib/google/apis/language_v2/service.rb
Overview
Cloud Natural Language API
Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://language.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#analyze_document_entities(analyze_entities_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnalyzeEntitiesResponse
Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.
-
#analyze_document_sentiment(analyze_sentiment_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnalyzeSentimentResponse
Analyzes the sentiment of the provided text.
-
#annotate_document_text(annotate_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnnotateTextResponse
A convenience method that provides all features in one call.
-
#classify_document_text(classify_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::ClassifyTextResponse
Classifies a document into categories.
-
#initialize ⇒ CloudNaturalLanguageService
constructor
A new instance of CloudNaturalLanguageService.
-
#moderate_document_text(moderate_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::ModerateTextResponse
Moderates a document for harmful and sensitive categories.
Constructor Details
#initialize ⇒ CloudNaturalLanguageService
Returns a new instance of CloudNaturalLanguageService.
49 50 51 52 53 54 |
# File 'lib/google/apis/language_v2/service.rb', line 49 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-language_v2', client_version: Google::Apis::LanguageV2::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
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.
42 43 44 |
# File 'lib/google/apis/language_v2/service.rb', line 42 def key @key end |
#quota_user ⇒ String
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.
47 48 49 |
# File 'lib/google/apis/language_v2/service.rb', line 47 def quota_user @quota_user end |
Instance Method Details
#analyze_document_entities(analyze_entities_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnalyzeEntitiesResponse
Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/google/apis/language_v2/service.rb', line 77 def analyze_document_entities(analyze_entities_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/documents:analyzeEntities', ) command.request_representation = Google::Apis::LanguageV2::AnalyzeEntitiesRequest::Representation command.request_object = analyze_entities_request_object command.response_representation = Google::Apis::LanguageV2::AnalyzeEntitiesResponse::Representation command.response_class = Google::Apis::LanguageV2::AnalyzeEntitiesResponse command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#analyze_document_sentiment(analyze_sentiment_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnalyzeSentimentResponse
Analyzes the sentiment of the provided text.
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/google/apis/language_v2/service.rb', line 107 def analyze_document_sentiment(analyze_sentiment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/documents:analyzeSentiment', ) command.request_representation = Google::Apis::LanguageV2::AnalyzeSentimentRequest::Representation command.request_object = analyze_sentiment_request_object command.response_representation = Google::Apis::LanguageV2::AnalyzeSentimentResponse::Representation command.response_class = Google::Apis::LanguageV2::AnalyzeSentimentResponse command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#annotate_document_text(annotate_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::AnnotateTextResponse
A convenience method that provides all features in one call.
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/google/apis/language_v2/service.rb', line 137 def annotate_document_text(annotate_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/documents:annotateText', ) command.request_representation = Google::Apis::LanguageV2::AnnotateTextRequest::Representation command.request_object = annotate_text_request_object command.response_representation = Google::Apis::LanguageV2::AnnotateTextResponse::Representation command.response_class = Google::Apis::LanguageV2::AnnotateTextResponse command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#classify_document_text(classify_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::ClassifyTextResponse
Classifies a document into categories.
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/google/apis/language_v2/service.rb', line 167 def classify_document_text(classify_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/documents:classifyText', ) command.request_representation = Google::Apis::LanguageV2::ClassifyTextRequest::Representation command.request_object = classify_text_request_object command.response_representation = Google::Apis::LanguageV2::ClassifyTextResponse::Representation command.response_class = Google::Apis::LanguageV2::ClassifyTextResponse command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#moderate_document_text(moderate_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LanguageV2::ModerateTextResponse
Moderates a document for harmful and sensitive categories.
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/google/apis/language_v2/service.rb', line 197 def moderate_document_text(moderate_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/documents:moderateText', ) command.request_representation = Google::Apis::LanguageV2::ModerateTextRequest::Representation command.request_object = moderate_text_request_object command.response_representation = Google::Apis::LanguageV2::ModerateTextResponse::Representation command.response_class = Google::Apis::LanguageV2::ModerateTextResponse command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |