google-cloud-language 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/google-cloud-language.rb +116 -0
- data/lib/google/cloud/language.rb +229 -0
- data/lib/google/cloud/language/annotation.rb +630 -0
- data/lib/google/cloud/language/credentials.rb +32 -0
- data/lib/google/cloud/language/document.rb +368 -0
- data/lib/google/cloud/language/project.rb +365 -0
- data/lib/google/cloud/language/service.rb +112 -0
- data/lib/google/cloud/language/v1beta1/language_service_api.rb +204 -0
- data/lib/google/cloud/language/v1beta1/language_service_client_config.json +43 -0
- data/lib/google/cloud/language/v1beta1/language_service_pb.rb +228 -0
- data/lib/google/cloud/language/v1beta1/language_service_services_pb.rb +54 -0
- data/lib/google/cloud/language/version.rb +22 -0
- metadata +241 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/cloud/errors"
|
17
|
+
require "google/cloud/language/credentials"
|
18
|
+
require "google/cloud/language/version"
|
19
|
+
require "google/cloud/language/v1beta1/language_service_api"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Language
|
24
|
+
##
|
25
|
+
# @private Represents the gRPC Language service, including all the API
|
26
|
+
# methods.
|
27
|
+
class Service
|
28
|
+
attr_accessor :project, :credentials, :host, :retries, :timeout
|
29
|
+
|
30
|
+
##
|
31
|
+
# Creates a new Service instance.
|
32
|
+
def initialize project, credentials, host: nil, retries: nil,
|
33
|
+
timeout: nil
|
34
|
+
@project = project
|
35
|
+
@credentials = credentials
|
36
|
+
@host = host || V1beta1::LanguageServiceApi::SERVICE_ADDRESS
|
37
|
+
@retries = retries
|
38
|
+
@timeout = timeout
|
39
|
+
end
|
40
|
+
|
41
|
+
def channel
|
42
|
+
GRPC::Core::Channel.new host, nil, chan_creds
|
43
|
+
end
|
44
|
+
|
45
|
+
def chan_creds
|
46
|
+
return credentials if insecure?
|
47
|
+
GRPC::Core::ChannelCredentials.new.compose \
|
48
|
+
GRPC::Core::CallCredentials.new credentials.client.updater_proc
|
49
|
+
end
|
50
|
+
|
51
|
+
def service
|
52
|
+
return mocked_service if mocked_service
|
53
|
+
@service ||= V1beta1::LanguageServiceApi.new(
|
54
|
+
service_path: host,
|
55
|
+
channel: channel,
|
56
|
+
timeout: timeout,
|
57
|
+
app_name: "google-cloud-language",
|
58
|
+
app_version: Google::Cloud::Language::VERSION)
|
59
|
+
# TODO: Get retries configured
|
60
|
+
end
|
61
|
+
attr_accessor :mocked_service
|
62
|
+
|
63
|
+
def insecure?
|
64
|
+
credentials == :this_channel_is_insecure
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Returns API::BatchAnnotateImagesResponse
|
69
|
+
def annotate doc_grpc, syntax: false, entities: false, sentiment: false,
|
70
|
+
encoding: nil
|
71
|
+
if syntax == false && entities == false && sentiment == false
|
72
|
+
syntax = true
|
73
|
+
entities = true
|
74
|
+
sentiment = true
|
75
|
+
end
|
76
|
+
features = V1beta1::AnnotateTextRequest::Features.new(
|
77
|
+
extract_syntax: syntax, extract_entities: entities,
|
78
|
+
extract_document_sentiment: sentiment)
|
79
|
+
encoding = verify_encoding! encoding
|
80
|
+
execute { service.annotate_text doc_grpc, features, encoding }
|
81
|
+
end
|
82
|
+
|
83
|
+
def entities doc_grpc, encoding: nil
|
84
|
+
encoding = verify_encoding! encoding
|
85
|
+
execute { service.analyze_entities doc_grpc, encoding }
|
86
|
+
end
|
87
|
+
|
88
|
+
def sentiment doc_grpc
|
89
|
+
execute { service.analyze_sentiment doc_grpc }
|
90
|
+
end
|
91
|
+
|
92
|
+
def inspect
|
93
|
+
"#{self.class}(#{@project})"
|
94
|
+
end
|
95
|
+
|
96
|
+
protected
|
97
|
+
|
98
|
+
def verify_encoding! encoding
|
99
|
+
# TODO: verify encoding against V1beta1::EncodingType
|
100
|
+
return :UTF8 if encoding.nil?
|
101
|
+
encoding
|
102
|
+
end
|
103
|
+
|
104
|
+
def execute
|
105
|
+
yield
|
106
|
+
rescue GRPC::BadStatus => e
|
107
|
+
raise Google::Cloud::Error.from_error(e)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
# EDITING INSTRUCTIONS
|
16
|
+
# This file was generated from the file
|
17
|
+
# https://github.com/googleapis/googleapis/blob/master/google/cloud/language/v1beta1/language_service.proto,
|
18
|
+
# and updates to that file get reflected here through a refresh process.
|
19
|
+
# For the short term, the refresh process will only be runnable by Google
|
20
|
+
# engineers.
|
21
|
+
#
|
22
|
+
# The only allowed edits are to method and file documentation. A 3-way
|
23
|
+
# merge preserves those additions if the generated source changes.
|
24
|
+
|
25
|
+
require "json"
|
26
|
+
require "pathname"
|
27
|
+
|
28
|
+
require "google/gax"
|
29
|
+
require "google/cloud/language/v1beta1/language_service_services_pb"
|
30
|
+
|
31
|
+
module Google
|
32
|
+
module Cloud
|
33
|
+
module Language
|
34
|
+
module V1beta1
|
35
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
36
|
+
# recognition.
|
37
|
+
#
|
38
|
+
# @!attribute [r] stub
|
39
|
+
# @return [Google::Cloud::Language::V1beta1::LanguageService::Stub]
|
40
|
+
class LanguageServiceApi
|
41
|
+
attr_reader :stub
|
42
|
+
|
43
|
+
# The default address of the service.
|
44
|
+
SERVICE_ADDRESS = "language.googleapis.com".freeze
|
45
|
+
|
46
|
+
# The default port of the service.
|
47
|
+
DEFAULT_SERVICE_PORT = 443
|
48
|
+
|
49
|
+
CODE_GEN_NAME_VERSION = "gapic/0.1.0".freeze
|
50
|
+
|
51
|
+
DEFAULT_TIMEOUT = 30
|
52
|
+
|
53
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
54
|
+
# this service.
|
55
|
+
ALL_SCOPES = [
|
56
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
57
|
+
].freeze
|
58
|
+
|
59
|
+
# @param service_path [String]
|
60
|
+
# The domain name of the API remote host.
|
61
|
+
# @param port [Integer]
|
62
|
+
# The port on which to connect to the remote host.
|
63
|
+
# @param channel [Channel]
|
64
|
+
# A Channel object through which to make calls.
|
65
|
+
# @param chan_creds [Grpc::ChannelCredentials]
|
66
|
+
# A ChannelCredentials for the setting up the RPC client.
|
67
|
+
# @param client_config[Hash]
|
68
|
+
# A Hash for call options for each method. See
|
69
|
+
# Google::Gax#construct_settings for the structure of
|
70
|
+
# this data. Falls back to the default config if not specified
|
71
|
+
# or the specified config is missing data points.
|
72
|
+
# @param timeout [Numeric]
|
73
|
+
# The default timeout, in seconds, for calls made through this client.
|
74
|
+
# @param app_name [String]
|
75
|
+
# The codename of the calling service.
|
76
|
+
# @param app_version [String]
|
77
|
+
# The version of the calling service.
|
78
|
+
def initialize \
|
79
|
+
service_path: SERVICE_ADDRESS,
|
80
|
+
port: DEFAULT_SERVICE_PORT,
|
81
|
+
channel: nil,
|
82
|
+
chan_creds: nil,
|
83
|
+
scopes: ALL_SCOPES,
|
84
|
+
client_config: {},
|
85
|
+
timeout: DEFAULT_TIMEOUT,
|
86
|
+
app_name: "gax",
|
87
|
+
app_version: Google::Gax::VERSION
|
88
|
+
google_api_client = "#{app_name}/#{app_version} " \
|
89
|
+
"#{CODE_GEN_NAME_VERSION} ruby/#{RUBY_VERSION}".freeze
|
90
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
91
|
+
client_config_file = Pathname.new(__dir__).join(
|
92
|
+
"language_service_client_config.json"
|
93
|
+
)
|
94
|
+
defaults = client_config_file.open do |f|
|
95
|
+
Google::Gax.construct_settings(
|
96
|
+
"google.cloud.language.v1beta1.LanguageService",
|
97
|
+
JSON.parse(f.read),
|
98
|
+
client_config,
|
99
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
100
|
+
timeout,
|
101
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
102
|
+
kwargs: headers
|
103
|
+
)
|
104
|
+
end
|
105
|
+
@stub = Google::Gax::Grpc.create_stub(
|
106
|
+
service_path,
|
107
|
+
port,
|
108
|
+
chan_creds: chan_creds,
|
109
|
+
channel: channel,
|
110
|
+
scopes: scopes,
|
111
|
+
&Google::Cloud::Language::V1beta1::LanguageService::Stub.method(:new)
|
112
|
+
)
|
113
|
+
|
114
|
+
@analyze_sentiment = Google::Gax.create_api_call(
|
115
|
+
@stub.method(:analyze_sentiment),
|
116
|
+
defaults["analyze_sentiment"]
|
117
|
+
)
|
118
|
+
@analyze_entities = Google::Gax.create_api_call(
|
119
|
+
@stub.method(:analyze_entities),
|
120
|
+
defaults["analyze_entities"]
|
121
|
+
)
|
122
|
+
@annotate_text = Google::Gax.create_api_call(
|
123
|
+
@stub.method(:annotate_text),
|
124
|
+
defaults["annotate_text"]
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Service calls
|
129
|
+
|
130
|
+
# Analyzes the sentiment of the provided text.
|
131
|
+
#
|
132
|
+
# @param document [Google::Cloud::Language::V1beta1::Document]
|
133
|
+
# Input document. Currently, +analyzeSentiment+ only supports English text
|
134
|
+
# (Document#language="EN").
|
135
|
+
# @param options [Google::Gax::CallOptions]
|
136
|
+
# Overrides the default settings for this call, e.g, timeout,
|
137
|
+
# retries, etc.
|
138
|
+
# @return [Google::Cloud::Language::V1beta1::AnalyzeSentimentResponse]
|
139
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
140
|
+
def analyze_sentiment \
|
141
|
+
document,
|
142
|
+
options: nil
|
143
|
+
req = Google::Cloud::Language::V1beta1::AnalyzeSentimentRequest.new(
|
144
|
+
document: document
|
145
|
+
)
|
146
|
+
@analyze_sentiment.call(req, options)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Finds named entities (currently finds proper names) in the text,
|
150
|
+
# entity types, salience, mentions for each entity, and other properties.
|
151
|
+
#
|
152
|
+
# @param document [Google::Cloud::Language::V1beta1::Document]
|
153
|
+
# Input document.
|
154
|
+
# @param encoding_type [Google::Cloud::Language::V1beta1::EncodingType]
|
155
|
+
# The encoding type used by the API to calculate offsets.
|
156
|
+
# @param options [Google::Gax::CallOptions]
|
157
|
+
# Overrides the default settings for this call, e.g, timeout,
|
158
|
+
# retries, etc.
|
159
|
+
# @return [Google::Cloud::Language::V1beta1::AnalyzeEntitiesResponse]
|
160
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
161
|
+
def analyze_entities \
|
162
|
+
document,
|
163
|
+
encoding_type,
|
164
|
+
options: nil
|
165
|
+
req = Google::Cloud::Language::V1beta1::AnalyzeEntitiesRequest.new(
|
166
|
+
document: document,
|
167
|
+
encoding_type: encoding_type
|
168
|
+
)
|
169
|
+
@analyze_entities.call(req, options)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Advanced API that analyzes the document and provides a full set of text
|
173
|
+
# annotations, including semantic, syntactic, and sentiment information. This
|
174
|
+
# API is intended for users who are familiar with machine learning and need
|
175
|
+
# in-depth text features to build upon.
|
176
|
+
#
|
177
|
+
# @param document [Google::Cloud::Language::V1beta1::Document]
|
178
|
+
# Input document.
|
179
|
+
# @param features [Google::Cloud::Language::V1beta1::AnnotateTextRequest::Features]
|
180
|
+
# The enabled features.
|
181
|
+
# @param encoding_type [Google::Cloud::Language::V1beta1::EncodingType]
|
182
|
+
# The encoding type used by the API to calculate offsets.
|
183
|
+
# @param options [Google::Gax::CallOptions]
|
184
|
+
# Overrides the default settings for this call, e.g, timeout,
|
185
|
+
# retries, etc.
|
186
|
+
# @return [Google::Cloud::Language::V1beta1::AnnotateTextResponse]
|
187
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
188
|
+
def annotate_text \
|
189
|
+
document,
|
190
|
+
features,
|
191
|
+
encoding_type,
|
192
|
+
options: nil
|
193
|
+
req = Google::Cloud::Language::V1beta1::AnnotateTextRequest.new(
|
194
|
+
document: document,
|
195
|
+
features: features,
|
196
|
+
encoding_type: encoding_type
|
197
|
+
)
|
198
|
+
@annotate_text.call(req, options)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"interfaces": {
|
3
|
+
"google.cloud.language.v1beta1.LanguageService": {
|
4
|
+
"retry_codes": {
|
5
|
+
"retry_codes_def": {
|
6
|
+
"idempotent": [
|
7
|
+
"DEADLINE_EXCEEDED",
|
8
|
+
"UNAVAILABLE"
|
9
|
+
],
|
10
|
+
"non_idempotent": []
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"retry_params": {
|
14
|
+
"default": {
|
15
|
+
"initial_retry_delay_millis": 100,
|
16
|
+
"retry_delay_multiplier": 1.3,
|
17
|
+
"max_retry_delay_millis": 60000,
|
18
|
+
"initial_rpc_timeout_millis": 60000,
|
19
|
+
"rpc_timeout_multiplier": 1.0,
|
20
|
+
"max_rpc_timeout_millis": 60000,
|
21
|
+
"total_timeout_millis": 600000
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"methods": {
|
25
|
+
"AnalyzeSentiment": {
|
26
|
+
"timeout_millis": 30000,
|
27
|
+
"retry_codes_name": "idempotent",
|
28
|
+
"retry_params_name": "default"
|
29
|
+
},
|
30
|
+
"AnalyzeEntities": {
|
31
|
+
"timeout_millis": 30000,
|
32
|
+
"retry_codes_name": "idempotent",
|
33
|
+
"retry_params_name": "default"
|
34
|
+
},
|
35
|
+
"AnnotateText": {
|
36
|
+
"timeout_millis": 30000,
|
37
|
+
"retry_codes_name": "idempotent",
|
38
|
+
"retry_params_name": "default"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,228 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/language/v1beta1/language_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_message "google.cloud.language.v1beta1.Document" do
|
9
|
+
optional :type, :enum, 1, "google.cloud.language.v1beta1.Document.Type"
|
10
|
+
optional :language, :string, 4
|
11
|
+
oneof :source do
|
12
|
+
optional :content, :string, 2
|
13
|
+
optional :gcs_content_uri, :string, 3
|
14
|
+
end
|
15
|
+
end
|
16
|
+
add_enum "google.cloud.language.v1beta1.Document.Type" do
|
17
|
+
value :TYPE_UNSPECIFIED, 0
|
18
|
+
value :PLAIN_TEXT, 1
|
19
|
+
value :HTML, 2
|
20
|
+
end
|
21
|
+
add_message "google.cloud.language.v1beta1.Sentence" do
|
22
|
+
optional :text, :message, 1, "google.cloud.language.v1beta1.TextSpan"
|
23
|
+
end
|
24
|
+
add_message "google.cloud.language.v1beta1.Entity" do
|
25
|
+
optional :name, :string, 1
|
26
|
+
optional :type, :enum, 2, "google.cloud.language.v1beta1.Entity.Type"
|
27
|
+
map :metadata, :string, :string, 3
|
28
|
+
optional :salience, :float, 4
|
29
|
+
repeated :mentions, :message, 5, "google.cloud.language.v1beta1.EntityMention"
|
30
|
+
end
|
31
|
+
add_enum "google.cloud.language.v1beta1.Entity.Type" do
|
32
|
+
value :UNKNOWN, 0
|
33
|
+
value :PERSON, 1
|
34
|
+
value :LOCATION, 2
|
35
|
+
value :ORGANIZATION, 3
|
36
|
+
value :EVENT, 4
|
37
|
+
value :WORK_OF_ART, 5
|
38
|
+
value :CONSUMER_GOOD, 6
|
39
|
+
value :OTHER, 7
|
40
|
+
end
|
41
|
+
add_message "google.cloud.language.v1beta1.Token" do
|
42
|
+
optional :text, :message, 1, "google.cloud.language.v1beta1.TextSpan"
|
43
|
+
optional :part_of_speech, :message, 2, "google.cloud.language.v1beta1.PartOfSpeech"
|
44
|
+
optional :dependency_edge, :message, 3, "google.cloud.language.v1beta1.DependencyEdge"
|
45
|
+
optional :lemma, :string, 4
|
46
|
+
end
|
47
|
+
add_message "google.cloud.language.v1beta1.Sentiment" do
|
48
|
+
optional :polarity, :float, 1
|
49
|
+
optional :magnitude, :float, 2
|
50
|
+
end
|
51
|
+
add_message "google.cloud.language.v1beta1.PartOfSpeech" do
|
52
|
+
optional :tag, :enum, 1, "google.cloud.language.v1beta1.PartOfSpeech.Tag"
|
53
|
+
end
|
54
|
+
add_enum "google.cloud.language.v1beta1.PartOfSpeech.Tag" do
|
55
|
+
value :UNKNOWN, 0
|
56
|
+
value :ADJ, 1
|
57
|
+
value :ADP, 2
|
58
|
+
value :ADV, 3
|
59
|
+
value :CONJ, 4
|
60
|
+
value :DET, 5
|
61
|
+
value :NOUN, 6
|
62
|
+
value :NUM, 7
|
63
|
+
value :PRON, 8
|
64
|
+
value :PRT, 9
|
65
|
+
value :PUNCT, 10
|
66
|
+
value :VERB, 11
|
67
|
+
value :X, 12
|
68
|
+
value :AFFIX, 13
|
69
|
+
end
|
70
|
+
add_message "google.cloud.language.v1beta1.DependencyEdge" do
|
71
|
+
optional :head_token_index, :int32, 1
|
72
|
+
optional :label, :enum, 2, "google.cloud.language.v1beta1.DependencyEdge.Label"
|
73
|
+
end
|
74
|
+
add_enum "google.cloud.language.v1beta1.DependencyEdge.Label" do
|
75
|
+
value :UNKNOWN, 0
|
76
|
+
value :ABBREV, 1
|
77
|
+
value :ACOMP, 2
|
78
|
+
value :ADVCL, 3
|
79
|
+
value :ADVMOD, 4
|
80
|
+
value :AMOD, 5
|
81
|
+
value :APPOS, 6
|
82
|
+
value :ATTR, 7
|
83
|
+
value :AUX, 8
|
84
|
+
value :AUXPASS, 9
|
85
|
+
value :CC, 10
|
86
|
+
value :CCOMP, 11
|
87
|
+
value :CONJ, 12
|
88
|
+
value :CSUBJ, 13
|
89
|
+
value :CSUBJPASS, 14
|
90
|
+
value :DEP, 15
|
91
|
+
value :DET, 16
|
92
|
+
value :DISCOURSE, 17
|
93
|
+
value :DOBJ, 18
|
94
|
+
value :EXPL, 19
|
95
|
+
value :GOESWITH, 20
|
96
|
+
value :IOBJ, 21
|
97
|
+
value :MARK, 22
|
98
|
+
value :MWE, 23
|
99
|
+
value :MWV, 24
|
100
|
+
value :NEG, 25
|
101
|
+
value :NN, 26
|
102
|
+
value :NPADVMOD, 27
|
103
|
+
value :NSUBJ, 28
|
104
|
+
value :NSUBJPASS, 29
|
105
|
+
value :NUM, 30
|
106
|
+
value :NUMBER, 31
|
107
|
+
value :P, 32
|
108
|
+
value :PARATAXIS, 33
|
109
|
+
value :PARTMOD, 34
|
110
|
+
value :PCOMP, 35
|
111
|
+
value :POBJ, 36
|
112
|
+
value :POSS, 37
|
113
|
+
value :POSTNEG, 38
|
114
|
+
value :PRECOMP, 39
|
115
|
+
value :PRECONJ, 40
|
116
|
+
value :PREDET, 41
|
117
|
+
value :PREF, 42
|
118
|
+
value :PREP, 43
|
119
|
+
value :PRONL, 44
|
120
|
+
value :PRT, 45
|
121
|
+
value :PS, 46
|
122
|
+
value :QUANTMOD, 47
|
123
|
+
value :RCMOD, 48
|
124
|
+
value :RCMODREL, 49
|
125
|
+
value :RDROP, 50
|
126
|
+
value :REF, 51
|
127
|
+
value :REMNANT, 52
|
128
|
+
value :REPARANDUM, 53
|
129
|
+
value :ROOT, 54
|
130
|
+
value :SNUM, 55
|
131
|
+
value :SUFF, 56
|
132
|
+
value :TMOD, 57
|
133
|
+
value :TOPIC, 58
|
134
|
+
value :VMOD, 59
|
135
|
+
value :VOCATIVE, 60
|
136
|
+
value :XCOMP, 61
|
137
|
+
value :SUFFIX, 62
|
138
|
+
value :TITLE, 63
|
139
|
+
value :ADVPHMOD, 64
|
140
|
+
value :AUXCAUS, 65
|
141
|
+
value :AUXVV, 66
|
142
|
+
value :DTMOD, 67
|
143
|
+
value :FOREIGN, 68
|
144
|
+
value :KW, 69
|
145
|
+
value :LIST, 70
|
146
|
+
value :NOMC, 71
|
147
|
+
value :NOMCSUBJ, 72
|
148
|
+
value :NOMCSUBJPASS, 73
|
149
|
+
value :NUMC, 74
|
150
|
+
value :COP, 75
|
151
|
+
value :DISLOCATED, 76
|
152
|
+
end
|
153
|
+
add_message "google.cloud.language.v1beta1.EntityMention" do
|
154
|
+
optional :text, :message, 1, "google.cloud.language.v1beta1.TextSpan"
|
155
|
+
end
|
156
|
+
add_message "google.cloud.language.v1beta1.TextSpan" do
|
157
|
+
optional :content, :string, 1
|
158
|
+
optional :begin_offset, :int32, 2
|
159
|
+
end
|
160
|
+
add_message "google.cloud.language.v1beta1.AnalyzeSentimentRequest" do
|
161
|
+
optional :document, :message, 1, "google.cloud.language.v1beta1.Document"
|
162
|
+
end
|
163
|
+
add_message "google.cloud.language.v1beta1.AnalyzeSentimentResponse" do
|
164
|
+
optional :document_sentiment, :message, 1, "google.cloud.language.v1beta1.Sentiment"
|
165
|
+
optional :language, :string, 2
|
166
|
+
end
|
167
|
+
add_message "google.cloud.language.v1beta1.AnalyzeEntitiesRequest" do
|
168
|
+
optional :document, :message, 1, "google.cloud.language.v1beta1.Document"
|
169
|
+
optional :encoding_type, :enum, 2, "google.cloud.language.v1beta1.EncodingType"
|
170
|
+
end
|
171
|
+
add_message "google.cloud.language.v1beta1.AnalyzeEntitiesResponse" do
|
172
|
+
repeated :entities, :message, 1, "google.cloud.language.v1beta1.Entity"
|
173
|
+
optional :language, :string, 2
|
174
|
+
end
|
175
|
+
add_message "google.cloud.language.v1beta1.AnnotateTextRequest" do
|
176
|
+
optional :document, :message, 1, "google.cloud.language.v1beta1.Document"
|
177
|
+
optional :features, :message, 2, "google.cloud.language.v1beta1.AnnotateTextRequest.Features"
|
178
|
+
optional :encoding_type, :enum, 3, "google.cloud.language.v1beta1.EncodingType"
|
179
|
+
end
|
180
|
+
add_message "google.cloud.language.v1beta1.AnnotateTextRequest.Features" do
|
181
|
+
optional :extract_syntax, :bool, 1
|
182
|
+
optional :extract_entities, :bool, 2
|
183
|
+
optional :extract_document_sentiment, :bool, 3
|
184
|
+
end
|
185
|
+
add_message "google.cloud.language.v1beta1.AnnotateTextResponse" do
|
186
|
+
repeated :sentences, :message, 1, "google.cloud.language.v1beta1.Sentence"
|
187
|
+
repeated :tokens, :message, 2, "google.cloud.language.v1beta1.Token"
|
188
|
+
repeated :entities, :message, 3, "google.cloud.language.v1beta1.Entity"
|
189
|
+
optional :document_sentiment, :message, 4, "google.cloud.language.v1beta1.Sentiment"
|
190
|
+
optional :language, :string, 5
|
191
|
+
end
|
192
|
+
add_enum "google.cloud.language.v1beta1.EncodingType" do
|
193
|
+
value :NONE, 0
|
194
|
+
value :UTF8, 1
|
195
|
+
value :UTF16, 2
|
196
|
+
value :UTF32, 3
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
module Google
|
201
|
+
module Cloud
|
202
|
+
module Language
|
203
|
+
module V1beta1
|
204
|
+
Document = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Document").msgclass
|
205
|
+
Document::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Document.Type").enummodule
|
206
|
+
Sentence = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Sentence").msgclass
|
207
|
+
Entity = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Entity").msgclass
|
208
|
+
Entity::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Entity.Type").enummodule
|
209
|
+
Token = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Token").msgclass
|
210
|
+
Sentiment = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.Sentiment").msgclass
|
211
|
+
PartOfSpeech = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.PartOfSpeech").msgclass
|
212
|
+
PartOfSpeech::Tag = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.PartOfSpeech.Tag").enummodule
|
213
|
+
DependencyEdge = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.DependencyEdge").msgclass
|
214
|
+
DependencyEdge::Label = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.DependencyEdge.Label").enummodule
|
215
|
+
EntityMention = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.EntityMention").msgclass
|
216
|
+
TextSpan = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.TextSpan").msgclass
|
217
|
+
AnalyzeSentimentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnalyzeSentimentRequest").msgclass
|
218
|
+
AnalyzeSentimentResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnalyzeSentimentResponse").msgclass
|
219
|
+
AnalyzeEntitiesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnalyzeEntitiesRequest").msgclass
|
220
|
+
AnalyzeEntitiesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnalyzeEntitiesResponse").msgclass
|
221
|
+
AnnotateTextRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnnotateTextRequest").msgclass
|
222
|
+
AnnotateTextRequest::Features = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnnotateTextRequest.Features").msgclass
|
223
|
+
AnnotateTextResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.AnnotateTextResponse").msgclass
|
224
|
+
EncodingType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v1beta1.EncodingType").enummodule
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|