google-apis-language_v1beta2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-language_v1beta2.rb +15 -0
- data/lib/google/apis/language_v1beta2.rb +41 -0
- data/lib/google/apis/language_v1beta2/classes.rb +881 -0
- data/lib/google/apis/language_v1beta2/gem_version.rb +28 -0
- data/lib/google/apis/language_v1beta2/representations.rb +420 -0
- data/lib/google/apis/language_v1beta2/service.rb +249 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 559c3a021cc40cee2db11a223ae9cfa0080cdc655441fb83ba84cee90f2b0218
|
4
|
+
data.tar.gz: 9635fce5a75c42737880e8aa329f1e5b2ca4ff93d30e1cea6c6405bde5aaf125
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68a1e120fd2931edac0fa2bb68449a20bc5b253349671f04e52b93cb972d335a8348a0cb93592f5e88f950b9a6e4fe25cd9b40447387f2f18e153f0126290cb7
|
7
|
+
data.tar.gz: ff0b6b827c1cecf7707980737d84a5b80cafcd86e192480604270273b93a19c167819ebcec2944c8f5d74ee5b978ce8ce6aabe30d2c602c2c73673db47ed5628
|
data/.yardopts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
--hide-void-return
|
2
|
+
--no-private
|
3
|
+
--verbose
|
4
|
+
--title=google-apis-language_v1beta2
|
5
|
+
--markup-provider=redcarpet
|
6
|
+
--markup=markdown
|
7
|
+
--main OVERVIEW.md
|
8
|
+
lib/google/apis/language_v1beta2/*.rb
|
9
|
+
lib/google/apis/language_v1beta2.rb
|
10
|
+
-
|
11
|
+
OVERVIEW.md
|
12
|
+
CHANGELOG.md
|
13
|
+
LICENSE.md
|
data/CHANGELOG.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/OVERVIEW.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Simple REST client for version V1beta2 of the Cloud Natural Language API
|
2
|
+
|
3
|
+
This is a simple client library for version V1beta2 of the Cloud Natural Language API. It provides:
|
4
|
+
|
5
|
+
* A client object that connects to the HTTP/JSON REST endpoint for the service.
|
6
|
+
* Ruby objects for data structures related to the service.
|
7
|
+
* Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.
|
8
|
+
* Control of retry, pagination, and timeouts.
|
9
|
+
|
10
|
+
Note that although this client library is supported and will continue to be updated to track changes to the service, it is otherwise considered complete and not under active development. Many Google services, especially Google Cloud Platform services, may provide a more modern client that is under more active development and improvement. See the section below titled *Which client should I use?* for more information.
|
11
|
+
|
12
|
+
## Getting started
|
13
|
+
|
14
|
+
### Before you begin
|
15
|
+
|
16
|
+
There are a few setup steps you need to complete before you can use this library:
|
17
|
+
|
18
|
+
1. If you don't already have a Google account, [sign up](https://www.google.com/accounts).
|
19
|
+
2. If you have never created a Google APIs Console project, read about [Managing Projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects) and create a project in the [Google API Console](https://console.cloud.google.com/).
|
20
|
+
3. Most APIs need to be enabled for your project. [Enable it](https://console.cloud.google.com/apis/library/language.googleapis.com) in the console.
|
21
|
+
|
22
|
+
### Installation
|
23
|
+
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'google-apis-language_v1beta2', '~> 0.1'
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
```
|
33
|
+
$ bundle
|
34
|
+
```
|
35
|
+
|
36
|
+
Or install it yourself as:
|
37
|
+
|
38
|
+
```
|
39
|
+
$ gem install google-apis-language_v1beta2
|
40
|
+
```
|
41
|
+
|
42
|
+
### Creating a client object
|
43
|
+
|
44
|
+
Once the gem is installed, you can load the client code and instantiate a client.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Load the client
|
48
|
+
require "google/apis/language_v1beta2"
|
49
|
+
|
50
|
+
# Create a client object
|
51
|
+
client = Google::Apis::LanguageV1beta2::CloudNaturalLanguageService.new
|
52
|
+
|
53
|
+
# Authenticate calls
|
54
|
+
client.authentication = # ... use the googleauth gem to create credentials
|
55
|
+
```
|
56
|
+
|
57
|
+
See the class reference docs for information on the methods you can call from a client.
|
58
|
+
|
59
|
+
## Documentation
|
60
|
+
|
61
|
+
More detailed descriptions of the Google simple REST clients are available in two documents.
|
62
|
+
|
63
|
+
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
|
64
|
+
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
|
65
|
+
|
66
|
+
(Note: the above documents are written for the simple REST clients in general, and their examples may not reflect the Language service in particular.)
|
67
|
+
|
68
|
+
For reference information on specific calls in the Cloud Natural Language API, see the {Google::Apis::LanguageV1beta2::CloudNaturalLanguageService class reference docs}.
|
69
|
+
|
70
|
+
## Which client should I use?
|
71
|
+
|
72
|
+
Google provides two types of Ruby API client libraries: **simple REST clients** and **modern clients**.
|
73
|
+
|
74
|
+
This library, `google-apis-language_v1beta2`, is a simple REST client. You can identify these clients by their gem names, which are always in the form `google-apis-<servicename>_<serviceversion>`. The simple REST clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.
|
75
|
+
|
76
|
+
Modern clients are produced by a modern code generator, sometimes combined with hand-crafted functionality. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Google Cloud Platform services, but do not yet support all the services covered by the simple clients.
|
77
|
+
|
78
|
+
Gem names for modern clients are often of the form `google-cloud-<service_name>`. (For example, [google-cloud-pubsub](https://rubygems.org/gems/google-cloud-pubsub).) Note that most modern clients also have corresponding "versioned" gems with names like `google-cloud-<service_name>-<version>`. (For example, [google-cloud-pubsub-v1](https://rubygems.org/gems/google-cloud-pubsub-v1).) The "versioned" gems can be used directly, but often provide lower-level interfaces. In most cases, the main gem is recommended.
|
79
|
+
|
80
|
+
**For most users, we recommend the modern client, if one is available.** Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.
|
81
|
+
|
82
|
+
The [product documentation](https://cloud.google.com/natural-language/) may provide guidance regarding the preferred client library to use.
|
83
|
+
|
84
|
+
## Supported Ruby versions
|
85
|
+
|
86
|
+
This library is supported on Ruby 2.5+.
|
87
|
+
|
88
|
+
Google provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.5 and later. Older versions of Ruby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
This library is licensed under Apache 2.0. Full license text is available in the {file:LICENSE.md LICENSE}.
|
93
|
+
|
94
|
+
## Support
|
95
|
+
|
96
|
+
Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
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
|
+
require "google/apis/language_v1beta2"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
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
|
+
require 'google/apis/language_v1beta2/service.rb'
|
16
|
+
require 'google/apis/language_v1beta2/classes.rb'
|
17
|
+
require 'google/apis/language_v1beta2/representations.rb'
|
18
|
+
require 'google/apis/language_v1beta2/gem_version.rb'
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Apis
|
22
|
+
# Cloud Natural Language API
|
23
|
+
#
|
24
|
+
# Provides natural language understanding technologies, such as sentiment
|
25
|
+
# analysis, entity recognition, entity sentiment analysis, and other text
|
26
|
+
# annotations, to developers.
|
27
|
+
#
|
28
|
+
# @see https://cloud.google.com/natural-language/
|
29
|
+
module LanguageV1beta2
|
30
|
+
# Version of the Cloud Natural Language API this client connects to.
|
31
|
+
# This is NOT the gem version.
|
32
|
+
VERSION = 'V1beta2'
|
33
|
+
|
34
|
+
# Apply machine learning models to reveal the structure and meaning of text
|
35
|
+
AUTH_CLOUD_LANGUAGE = 'https://www.googleapis.com/auth/cloud-language'
|
36
|
+
|
37
|
+
# View and manage your data across Google Cloud Platform services
|
38
|
+
AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,881 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
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
|
+
require 'date'
|
16
|
+
require 'google/apis/core/base_service'
|
17
|
+
require 'google/apis/core/json_representation'
|
18
|
+
require 'google/apis/core/hashable'
|
19
|
+
require 'google/apis/errors'
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Apis
|
23
|
+
module LanguageV1beta2
|
24
|
+
|
25
|
+
# The entity analysis request message.
|
26
|
+
class AnalyzeEntitiesRequest
|
27
|
+
include Google::Apis::Core::Hashable
|
28
|
+
|
29
|
+
# ################################################################ # Represents
|
30
|
+
# the input to API methods.
|
31
|
+
# Corresponds to the JSON property `document`
|
32
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
33
|
+
attr_accessor :document
|
34
|
+
|
35
|
+
# The encoding type used by the API to calculate offsets.
|
36
|
+
# Corresponds to the JSON property `encodingType`
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :encoding_type
|
39
|
+
|
40
|
+
def initialize(**args)
|
41
|
+
update!(**args)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Update properties of this object
|
45
|
+
def update!(**args)
|
46
|
+
@document = args[:document] if args.key?(:document)
|
47
|
+
@encoding_type = args[:encoding_type] if args.key?(:encoding_type)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# The entity analysis response message.
|
52
|
+
class AnalyzeEntitiesResponse
|
53
|
+
include Google::Apis::Core::Hashable
|
54
|
+
|
55
|
+
# The recognized entities in the input document.
|
56
|
+
# Corresponds to the JSON property `entities`
|
57
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Entity>]
|
58
|
+
attr_accessor :entities
|
59
|
+
|
60
|
+
# The language of the text, which will be the same as the language specified in
|
61
|
+
# the request or, if not specified, the automatically-detected language. See
|
62
|
+
# Document.language field for more details.
|
63
|
+
# Corresponds to the JSON property `language`
|
64
|
+
# @return [String]
|
65
|
+
attr_accessor :language
|
66
|
+
|
67
|
+
def initialize(**args)
|
68
|
+
update!(**args)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Update properties of this object
|
72
|
+
def update!(**args)
|
73
|
+
@entities = args[:entities] if args.key?(:entities)
|
74
|
+
@language = args[:language] if args.key?(:language)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# The entity-level sentiment analysis request message.
|
79
|
+
class AnalyzeEntitySentimentRequest
|
80
|
+
include Google::Apis::Core::Hashable
|
81
|
+
|
82
|
+
# ################################################################ # Represents
|
83
|
+
# the input to API methods.
|
84
|
+
# Corresponds to the JSON property `document`
|
85
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
86
|
+
attr_accessor :document
|
87
|
+
|
88
|
+
# The encoding type used by the API to calculate offsets.
|
89
|
+
# Corresponds to the JSON property `encodingType`
|
90
|
+
# @return [String]
|
91
|
+
attr_accessor :encoding_type
|
92
|
+
|
93
|
+
def initialize(**args)
|
94
|
+
update!(**args)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Update properties of this object
|
98
|
+
def update!(**args)
|
99
|
+
@document = args[:document] if args.key?(:document)
|
100
|
+
@encoding_type = args[:encoding_type] if args.key?(:encoding_type)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# The entity-level sentiment analysis response message.
|
105
|
+
class AnalyzeEntitySentimentResponse
|
106
|
+
include Google::Apis::Core::Hashable
|
107
|
+
|
108
|
+
# The recognized entities in the input document with associated sentiments.
|
109
|
+
# Corresponds to the JSON property `entities`
|
110
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Entity>]
|
111
|
+
attr_accessor :entities
|
112
|
+
|
113
|
+
# The language of the text, which will be the same as the language specified in
|
114
|
+
# the request or, if not specified, the automatically-detected language. See
|
115
|
+
# Document.language field for more details.
|
116
|
+
# Corresponds to the JSON property `language`
|
117
|
+
# @return [String]
|
118
|
+
attr_accessor :language
|
119
|
+
|
120
|
+
def initialize(**args)
|
121
|
+
update!(**args)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Update properties of this object
|
125
|
+
def update!(**args)
|
126
|
+
@entities = args[:entities] if args.key?(:entities)
|
127
|
+
@language = args[:language] if args.key?(:language)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# The sentiment analysis request message.
|
132
|
+
class AnalyzeSentimentRequest
|
133
|
+
include Google::Apis::Core::Hashable
|
134
|
+
|
135
|
+
# ################################################################ # Represents
|
136
|
+
# the input to API methods.
|
137
|
+
# Corresponds to the JSON property `document`
|
138
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
139
|
+
attr_accessor :document
|
140
|
+
|
141
|
+
# The encoding type used by the API to calculate sentence offsets for the
|
142
|
+
# sentence sentiment.
|
143
|
+
# Corresponds to the JSON property `encodingType`
|
144
|
+
# @return [String]
|
145
|
+
attr_accessor :encoding_type
|
146
|
+
|
147
|
+
def initialize(**args)
|
148
|
+
update!(**args)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Update properties of this object
|
152
|
+
def update!(**args)
|
153
|
+
@document = args[:document] if args.key?(:document)
|
154
|
+
@encoding_type = args[:encoding_type] if args.key?(:encoding_type)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# The sentiment analysis response message.
|
159
|
+
class AnalyzeSentimentResponse
|
160
|
+
include Google::Apis::Core::Hashable
|
161
|
+
|
162
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
163
|
+
# Next ID: 6
|
164
|
+
# Corresponds to the JSON property `documentSentiment`
|
165
|
+
# @return [Google::Apis::LanguageV1beta2::Sentiment]
|
166
|
+
attr_accessor :document_sentiment
|
167
|
+
|
168
|
+
# The language of the text, which will be the same as the language specified in
|
169
|
+
# the request or, if not specified, the automatically-detected language. See
|
170
|
+
# Document.language field for more details.
|
171
|
+
# Corresponds to the JSON property `language`
|
172
|
+
# @return [String]
|
173
|
+
attr_accessor :language
|
174
|
+
|
175
|
+
# The sentiment for all the sentences in the document.
|
176
|
+
# Corresponds to the JSON property `sentences`
|
177
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Sentence>]
|
178
|
+
attr_accessor :sentences
|
179
|
+
|
180
|
+
def initialize(**args)
|
181
|
+
update!(**args)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Update properties of this object
|
185
|
+
def update!(**args)
|
186
|
+
@document_sentiment = args[:document_sentiment] if args.key?(:document_sentiment)
|
187
|
+
@language = args[:language] if args.key?(:language)
|
188
|
+
@sentences = args[:sentences] if args.key?(:sentences)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# The syntax analysis request message.
|
193
|
+
class AnalyzeSyntaxRequest
|
194
|
+
include Google::Apis::Core::Hashable
|
195
|
+
|
196
|
+
# ################################################################ # Represents
|
197
|
+
# the input to API methods.
|
198
|
+
# Corresponds to the JSON property `document`
|
199
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
200
|
+
attr_accessor :document
|
201
|
+
|
202
|
+
# The encoding type used by the API to calculate offsets.
|
203
|
+
# Corresponds to the JSON property `encodingType`
|
204
|
+
# @return [String]
|
205
|
+
attr_accessor :encoding_type
|
206
|
+
|
207
|
+
def initialize(**args)
|
208
|
+
update!(**args)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Update properties of this object
|
212
|
+
def update!(**args)
|
213
|
+
@document = args[:document] if args.key?(:document)
|
214
|
+
@encoding_type = args[:encoding_type] if args.key?(:encoding_type)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# The syntax analysis response message.
|
219
|
+
class AnalyzeSyntaxResponse
|
220
|
+
include Google::Apis::Core::Hashable
|
221
|
+
|
222
|
+
# The language of the text, which will be the same as the language specified in
|
223
|
+
# the request or, if not specified, the automatically-detected language. See
|
224
|
+
# Document.language field for more details.
|
225
|
+
# Corresponds to the JSON property `language`
|
226
|
+
# @return [String]
|
227
|
+
attr_accessor :language
|
228
|
+
|
229
|
+
# Sentences in the input document.
|
230
|
+
# Corresponds to the JSON property `sentences`
|
231
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Sentence>]
|
232
|
+
attr_accessor :sentences
|
233
|
+
|
234
|
+
# Tokens, along with their syntactic information, in the input document.
|
235
|
+
# Corresponds to the JSON property `tokens`
|
236
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Token>]
|
237
|
+
attr_accessor :tokens
|
238
|
+
|
239
|
+
def initialize(**args)
|
240
|
+
update!(**args)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Update properties of this object
|
244
|
+
def update!(**args)
|
245
|
+
@language = args[:language] if args.key?(:language)
|
246
|
+
@sentences = args[:sentences] if args.key?(:sentences)
|
247
|
+
@tokens = args[:tokens] if args.key?(:tokens)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
# The request message for the text annotation API, which can perform multiple
|
252
|
+
# analysis types (sentiment, entities, and syntax) in one call.
|
253
|
+
class AnnotateTextRequest
|
254
|
+
include Google::Apis::Core::Hashable
|
255
|
+
|
256
|
+
# ################################################################ # Represents
|
257
|
+
# the input to API methods.
|
258
|
+
# Corresponds to the JSON property `document`
|
259
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
260
|
+
attr_accessor :document
|
261
|
+
|
262
|
+
# The encoding type used by the API to calculate offsets.
|
263
|
+
# Corresponds to the JSON property `encodingType`
|
264
|
+
# @return [String]
|
265
|
+
attr_accessor :encoding_type
|
266
|
+
|
267
|
+
# All available features for sentiment, syntax, and semantic analysis. Setting
|
268
|
+
# each one to true will enable that specific analysis for the input. Next ID: 10
|
269
|
+
# Corresponds to the JSON property `features`
|
270
|
+
# @return [Google::Apis::LanguageV1beta2::Features]
|
271
|
+
attr_accessor :features
|
272
|
+
|
273
|
+
def initialize(**args)
|
274
|
+
update!(**args)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Update properties of this object
|
278
|
+
def update!(**args)
|
279
|
+
@document = args[:document] if args.key?(:document)
|
280
|
+
@encoding_type = args[:encoding_type] if args.key?(:encoding_type)
|
281
|
+
@features = args[:features] if args.key?(:features)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# The text annotations response message.
|
286
|
+
class AnnotateTextResponse
|
287
|
+
include Google::Apis::Core::Hashable
|
288
|
+
|
289
|
+
# Categories identified in the input document.
|
290
|
+
# Corresponds to the JSON property `categories`
|
291
|
+
# @return [Array<Google::Apis::LanguageV1beta2::ClassificationCategory>]
|
292
|
+
attr_accessor :categories
|
293
|
+
|
294
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
295
|
+
# Next ID: 6
|
296
|
+
# Corresponds to the JSON property `documentSentiment`
|
297
|
+
# @return [Google::Apis::LanguageV1beta2::Sentiment]
|
298
|
+
attr_accessor :document_sentiment
|
299
|
+
|
300
|
+
# Entities, along with their semantic information, in the input document.
|
301
|
+
# Populated if the user enables AnnotateTextRequest.Features.extract_entities.
|
302
|
+
# Corresponds to the JSON property `entities`
|
303
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Entity>]
|
304
|
+
attr_accessor :entities
|
305
|
+
|
306
|
+
# The language of the text, which will be the same as the language specified in
|
307
|
+
# the request or, if not specified, the automatically-detected language. See
|
308
|
+
# Document.language field for more details.
|
309
|
+
# Corresponds to the JSON property `language`
|
310
|
+
# @return [String]
|
311
|
+
attr_accessor :language
|
312
|
+
|
313
|
+
# Sentences in the input document. Populated if the user enables
|
314
|
+
# AnnotateTextRequest.Features.extract_syntax.
|
315
|
+
# Corresponds to the JSON property `sentences`
|
316
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Sentence>]
|
317
|
+
attr_accessor :sentences
|
318
|
+
|
319
|
+
# Tokens, along with their syntactic information, in the input document.
|
320
|
+
# Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
|
321
|
+
# Corresponds to the JSON property `tokens`
|
322
|
+
# @return [Array<Google::Apis::LanguageV1beta2::Token>]
|
323
|
+
attr_accessor :tokens
|
324
|
+
|
325
|
+
def initialize(**args)
|
326
|
+
update!(**args)
|
327
|
+
end
|
328
|
+
|
329
|
+
# Update properties of this object
|
330
|
+
def update!(**args)
|
331
|
+
@categories = args[:categories] if args.key?(:categories)
|
332
|
+
@document_sentiment = args[:document_sentiment] if args.key?(:document_sentiment)
|
333
|
+
@entities = args[:entities] if args.key?(:entities)
|
334
|
+
@language = args[:language] if args.key?(:language)
|
335
|
+
@sentences = args[:sentences] if args.key?(:sentences)
|
336
|
+
@tokens = args[:tokens] if args.key?(:tokens)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
# Represents a category returned from the text classifier.
|
341
|
+
class ClassificationCategory
|
342
|
+
include Google::Apis::Core::Hashable
|
343
|
+
|
344
|
+
# The classifier's confidence of the category. Number represents how certain the
|
345
|
+
# classifier is that this category represents the given text.
|
346
|
+
# Corresponds to the JSON property `confidence`
|
347
|
+
# @return [Float]
|
348
|
+
attr_accessor :confidence
|
349
|
+
|
350
|
+
# The name of the category representing the document, from the [predefined
|
351
|
+
# taxonomy](https://cloud.google.com/natural-language/docs/categories).
|
352
|
+
# Corresponds to the JSON property `name`
|
353
|
+
# @return [String]
|
354
|
+
attr_accessor :name
|
355
|
+
|
356
|
+
def initialize(**args)
|
357
|
+
update!(**args)
|
358
|
+
end
|
359
|
+
|
360
|
+
# Update properties of this object
|
361
|
+
def update!(**args)
|
362
|
+
@confidence = args[:confidence] if args.key?(:confidence)
|
363
|
+
@name = args[:name] if args.key?(:name)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# The document classification request message.
|
368
|
+
class ClassifyTextRequest
|
369
|
+
include Google::Apis::Core::Hashable
|
370
|
+
|
371
|
+
# ################################################################ # Represents
|
372
|
+
# the input to API methods.
|
373
|
+
# Corresponds to the JSON property `document`
|
374
|
+
# @return [Google::Apis::LanguageV1beta2::Document]
|
375
|
+
attr_accessor :document
|
376
|
+
|
377
|
+
def initialize(**args)
|
378
|
+
update!(**args)
|
379
|
+
end
|
380
|
+
|
381
|
+
# Update properties of this object
|
382
|
+
def update!(**args)
|
383
|
+
@document = args[:document] if args.key?(:document)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
# The document classification response message.
|
388
|
+
class ClassifyTextResponse
|
389
|
+
include Google::Apis::Core::Hashable
|
390
|
+
|
391
|
+
# Categories representing the input document.
|
392
|
+
# Corresponds to the JSON property `categories`
|
393
|
+
# @return [Array<Google::Apis::LanguageV1beta2::ClassificationCategory>]
|
394
|
+
attr_accessor :categories
|
395
|
+
|
396
|
+
def initialize(**args)
|
397
|
+
update!(**args)
|
398
|
+
end
|
399
|
+
|
400
|
+
# Update properties of this object
|
401
|
+
def update!(**args)
|
402
|
+
@categories = args[:categories] if args.key?(:categories)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
# Represents dependency parse tree information for a token.
|
407
|
+
class DependencyEdge
|
408
|
+
include Google::Apis::Core::Hashable
|
409
|
+
|
410
|
+
# Represents the head of this token in the dependency tree. This is the index of
|
411
|
+
# the token which has an arc going to this token. The index is the position of
|
412
|
+
# the token in the array of tokens returned by the API method. If this token is
|
413
|
+
# a root token, then the `head_token_index` is its own index.
|
414
|
+
# Corresponds to the JSON property `headTokenIndex`
|
415
|
+
# @return [Fixnum]
|
416
|
+
attr_accessor :head_token_index
|
417
|
+
|
418
|
+
# The parse label for the token.
|
419
|
+
# Corresponds to the JSON property `label`
|
420
|
+
# @return [String]
|
421
|
+
attr_accessor :label
|
422
|
+
|
423
|
+
def initialize(**args)
|
424
|
+
update!(**args)
|
425
|
+
end
|
426
|
+
|
427
|
+
# Update properties of this object
|
428
|
+
def update!(**args)
|
429
|
+
@head_token_index = args[:head_token_index] if args.key?(:head_token_index)
|
430
|
+
@label = args[:label] if args.key?(:label)
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
# ################################################################ # Represents
|
435
|
+
# the input to API methods.
|
436
|
+
class Document
|
437
|
+
include Google::Apis::Core::Hashable
|
438
|
+
|
439
|
+
# Indicates how detected boilerplate(e.g. advertisements, copyright declarations,
|
440
|
+
# banners) should be handled for this document. If not specified, boilerplate
|
441
|
+
# will be treated the same as content.
|
442
|
+
# Corresponds to the JSON property `boilerplateHandling`
|
443
|
+
# @return [String]
|
444
|
+
attr_accessor :boilerplate_handling
|
445
|
+
|
446
|
+
# The content of the input in string format. Cloud audit logging exempt since it
|
447
|
+
# is based on user data.
|
448
|
+
# Corresponds to the JSON property `content`
|
449
|
+
# @return [String]
|
450
|
+
attr_accessor :content
|
451
|
+
|
452
|
+
# The Google Cloud Storage URI where the file content is located. This URI must
|
453
|
+
# be of the form: gs://bucket_name/object_name. For more details, see https://
|
454
|
+
# cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object
|
455
|
+
# versioning is not supported.
|
456
|
+
# Corresponds to the JSON property `gcsContentUri`
|
457
|
+
# @return [String]
|
458
|
+
attr_accessor :gcs_content_uri
|
459
|
+
|
460
|
+
# The language of the document (if not specified, the language is automatically
|
461
|
+
# detected). Both ISO and BCP-47 language codes are accepted. [Language Support](
|
462
|
+
# https://cloud.google.com/natural-language/docs/languages) lists currently
|
463
|
+
# supported languages for each API method. If the language (either specified by
|
464
|
+
# the caller or automatically detected) is not supported by the called API
|
465
|
+
# method, an `INVALID_ARGUMENT` error is returned.
|
466
|
+
# Corresponds to the JSON property `language`
|
467
|
+
# @return [String]
|
468
|
+
attr_accessor :language
|
469
|
+
|
470
|
+
# The web URI where the document comes from. This URI is not used for fetching
|
471
|
+
# the content, but as a hint for analyzing the document.
|
472
|
+
# Corresponds to the JSON property `referenceWebUri`
|
473
|
+
# @return [String]
|
474
|
+
attr_accessor :reference_web_uri
|
475
|
+
|
476
|
+
# Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `
|
477
|
+
# INVALID_ARGUMENT` error.
|
478
|
+
# Corresponds to the JSON property `type`
|
479
|
+
# @return [String]
|
480
|
+
attr_accessor :type
|
481
|
+
|
482
|
+
def initialize(**args)
|
483
|
+
update!(**args)
|
484
|
+
end
|
485
|
+
|
486
|
+
# Update properties of this object
|
487
|
+
def update!(**args)
|
488
|
+
@boilerplate_handling = args[:boilerplate_handling] if args.key?(:boilerplate_handling)
|
489
|
+
@content = args[:content] if args.key?(:content)
|
490
|
+
@gcs_content_uri = args[:gcs_content_uri] if args.key?(:gcs_content_uri)
|
491
|
+
@language = args[:language] if args.key?(:language)
|
492
|
+
@reference_web_uri = args[:reference_web_uri] if args.key?(:reference_web_uri)
|
493
|
+
@type = args[:type] if args.key?(:type)
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
# Represents a phrase in the text that is a known entity, such as a person, an
|
498
|
+
# organization, or location. The API associates information, such as salience
|
499
|
+
# and mentions, with entities.
|
500
|
+
class Entity
|
501
|
+
include Google::Apis::Core::Hashable
|
502
|
+
|
503
|
+
# The mentions of this entity in the input document. The API currently supports
|
504
|
+
# proper noun mentions.
|
505
|
+
# Corresponds to the JSON property `mentions`
|
506
|
+
# @return [Array<Google::Apis::LanguageV1beta2::EntityMention>]
|
507
|
+
attr_accessor :mentions
|
508
|
+
|
509
|
+
# Metadata associated with the entity. For most entity types, the metadata is a
|
510
|
+
# Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are
|
511
|
+
# available. For the metadata associated with other entity types, see the Type
|
512
|
+
# table below.
|
513
|
+
# Corresponds to the JSON property `metadata`
|
514
|
+
# @return [Hash<String,String>]
|
515
|
+
attr_accessor :metadata
|
516
|
+
|
517
|
+
# The representative name for the entity.
|
518
|
+
# Corresponds to the JSON property `name`
|
519
|
+
# @return [String]
|
520
|
+
attr_accessor :name
|
521
|
+
|
522
|
+
# The salience score associated with the entity in the [0, 1.0] range. The
|
523
|
+
# salience score for an entity provides information about the importance or
|
524
|
+
# centrality of that entity to the entire document text. Scores closer to 0 are
|
525
|
+
# less salient, while scores closer to 1.0 are highly salient.
|
526
|
+
# Corresponds to the JSON property `salience`
|
527
|
+
# @return [Float]
|
528
|
+
attr_accessor :salience
|
529
|
+
|
530
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
531
|
+
# Next ID: 6
|
532
|
+
# Corresponds to the JSON property `sentiment`
|
533
|
+
# @return [Google::Apis::LanguageV1beta2::Sentiment]
|
534
|
+
attr_accessor :sentiment
|
535
|
+
|
536
|
+
# The entity type.
|
537
|
+
# Corresponds to the JSON property `type`
|
538
|
+
# @return [String]
|
539
|
+
attr_accessor :type
|
540
|
+
|
541
|
+
def initialize(**args)
|
542
|
+
update!(**args)
|
543
|
+
end
|
544
|
+
|
545
|
+
# Update properties of this object
|
546
|
+
def update!(**args)
|
547
|
+
@mentions = args[:mentions] if args.key?(:mentions)
|
548
|
+
@metadata = args[:metadata] if args.key?(:metadata)
|
549
|
+
@name = args[:name] if args.key?(:name)
|
550
|
+
@salience = args[:salience] if args.key?(:salience)
|
551
|
+
@sentiment = args[:sentiment] if args.key?(:sentiment)
|
552
|
+
@type = args[:type] if args.key?(:type)
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
# Represents a mention for an entity in the text. Currently, proper noun
|
557
|
+
# mentions are supported.
|
558
|
+
class EntityMention
|
559
|
+
include Google::Apis::Core::Hashable
|
560
|
+
|
561
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
562
|
+
# Next ID: 6
|
563
|
+
# Corresponds to the JSON property `sentiment`
|
564
|
+
# @return [Google::Apis::LanguageV1beta2::Sentiment]
|
565
|
+
attr_accessor :sentiment
|
566
|
+
|
567
|
+
# Represents an output piece of text.
|
568
|
+
# Corresponds to the JSON property `text`
|
569
|
+
# @return [Google::Apis::LanguageV1beta2::TextSpan]
|
570
|
+
attr_accessor :text
|
571
|
+
|
572
|
+
# The type of the entity mention.
|
573
|
+
# Corresponds to the JSON property `type`
|
574
|
+
# @return [String]
|
575
|
+
attr_accessor :type
|
576
|
+
|
577
|
+
def initialize(**args)
|
578
|
+
update!(**args)
|
579
|
+
end
|
580
|
+
|
581
|
+
# Update properties of this object
|
582
|
+
def update!(**args)
|
583
|
+
@sentiment = args[:sentiment] if args.key?(:sentiment)
|
584
|
+
@text = args[:text] if args.key?(:text)
|
585
|
+
@type = args[:type] if args.key?(:type)
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# All available features for sentiment, syntax, and semantic analysis. Setting
|
590
|
+
# each one to true will enable that specific analysis for the input. Next ID: 10
|
591
|
+
class Features
|
592
|
+
include Google::Apis::Core::Hashable
|
593
|
+
|
594
|
+
# Classify the full document into categories. If this is true, the API will use
|
595
|
+
# the default model which classifies into a [predefined taxonomy](https://cloud.
|
596
|
+
# google.com/natural-language/docs/categories).
|
597
|
+
# Corresponds to the JSON property `classifyText`
|
598
|
+
# @return [Boolean]
|
599
|
+
attr_accessor :classify_text
|
600
|
+
alias_method :classify_text?, :classify_text
|
601
|
+
|
602
|
+
# Extract document-level sentiment.
|
603
|
+
# Corresponds to the JSON property `extractDocumentSentiment`
|
604
|
+
# @return [Boolean]
|
605
|
+
attr_accessor :extract_document_sentiment
|
606
|
+
alias_method :extract_document_sentiment?, :extract_document_sentiment
|
607
|
+
|
608
|
+
# Extract entities.
|
609
|
+
# Corresponds to the JSON property `extractEntities`
|
610
|
+
# @return [Boolean]
|
611
|
+
attr_accessor :extract_entities
|
612
|
+
alias_method :extract_entities?, :extract_entities
|
613
|
+
|
614
|
+
# Extract entities and their associated sentiment.
|
615
|
+
# Corresponds to the JSON property `extractEntitySentiment`
|
616
|
+
# @return [Boolean]
|
617
|
+
attr_accessor :extract_entity_sentiment
|
618
|
+
alias_method :extract_entity_sentiment?, :extract_entity_sentiment
|
619
|
+
|
620
|
+
# Extract syntax information.
|
621
|
+
# Corresponds to the JSON property `extractSyntax`
|
622
|
+
# @return [Boolean]
|
623
|
+
attr_accessor :extract_syntax
|
624
|
+
alias_method :extract_syntax?, :extract_syntax
|
625
|
+
|
626
|
+
def initialize(**args)
|
627
|
+
update!(**args)
|
628
|
+
end
|
629
|
+
|
630
|
+
# Update properties of this object
|
631
|
+
def update!(**args)
|
632
|
+
@classify_text = args[:classify_text] if args.key?(:classify_text)
|
633
|
+
@extract_document_sentiment = args[:extract_document_sentiment] if args.key?(:extract_document_sentiment)
|
634
|
+
@extract_entities = args[:extract_entities] if args.key?(:extract_entities)
|
635
|
+
@extract_entity_sentiment = args[:extract_entity_sentiment] if args.key?(:extract_entity_sentiment)
|
636
|
+
@extract_syntax = args[:extract_syntax] if args.key?(:extract_syntax)
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
# Represents part of speech information for a token.
|
641
|
+
class PartOfSpeech
|
642
|
+
include Google::Apis::Core::Hashable
|
643
|
+
|
644
|
+
# The grammatical aspect.
|
645
|
+
# Corresponds to the JSON property `aspect`
|
646
|
+
# @return [String]
|
647
|
+
attr_accessor :aspect
|
648
|
+
|
649
|
+
# The grammatical case.
|
650
|
+
# Corresponds to the JSON property `case`
|
651
|
+
# @return [String]
|
652
|
+
attr_accessor :case
|
653
|
+
|
654
|
+
# The grammatical form.
|
655
|
+
# Corresponds to the JSON property `form`
|
656
|
+
# @return [String]
|
657
|
+
attr_accessor :form
|
658
|
+
|
659
|
+
# The grammatical gender.
|
660
|
+
# Corresponds to the JSON property `gender`
|
661
|
+
# @return [String]
|
662
|
+
attr_accessor :gender
|
663
|
+
|
664
|
+
# The grammatical mood.
|
665
|
+
# Corresponds to the JSON property `mood`
|
666
|
+
# @return [String]
|
667
|
+
attr_accessor :mood
|
668
|
+
|
669
|
+
# The grammatical number.
|
670
|
+
# Corresponds to the JSON property `number`
|
671
|
+
# @return [String]
|
672
|
+
attr_accessor :number
|
673
|
+
|
674
|
+
# The grammatical person.
|
675
|
+
# Corresponds to the JSON property `person`
|
676
|
+
# @return [String]
|
677
|
+
attr_accessor :person
|
678
|
+
|
679
|
+
# The grammatical properness.
|
680
|
+
# Corresponds to the JSON property `proper`
|
681
|
+
# @return [String]
|
682
|
+
attr_accessor :proper
|
683
|
+
|
684
|
+
# The grammatical reciprocity.
|
685
|
+
# Corresponds to the JSON property `reciprocity`
|
686
|
+
# @return [String]
|
687
|
+
attr_accessor :reciprocity
|
688
|
+
|
689
|
+
# The part of speech tag.
|
690
|
+
# Corresponds to the JSON property `tag`
|
691
|
+
# @return [String]
|
692
|
+
attr_accessor :tag
|
693
|
+
|
694
|
+
# The grammatical tense.
|
695
|
+
# Corresponds to the JSON property `tense`
|
696
|
+
# @return [String]
|
697
|
+
attr_accessor :tense
|
698
|
+
|
699
|
+
# The grammatical voice.
|
700
|
+
# Corresponds to the JSON property `voice`
|
701
|
+
# @return [String]
|
702
|
+
attr_accessor :voice
|
703
|
+
|
704
|
+
def initialize(**args)
|
705
|
+
update!(**args)
|
706
|
+
end
|
707
|
+
|
708
|
+
# Update properties of this object
|
709
|
+
def update!(**args)
|
710
|
+
@aspect = args[:aspect] if args.key?(:aspect)
|
711
|
+
@case = args[:case] if args.key?(:case)
|
712
|
+
@form = args[:form] if args.key?(:form)
|
713
|
+
@gender = args[:gender] if args.key?(:gender)
|
714
|
+
@mood = args[:mood] if args.key?(:mood)
|
715
|
+
@number = args[:number] if args.key?(:number)
|
716
|
+
@person = args[:person] if args.key?(:person)
|
717
|
+
@proper = args[:proper] if args.key?(:proper)
|
718
|
+
@reciprocity = args[:reciprocity] if args.key?(:reciprocity)
|
719
|
+
@tag = args[:tag] if args.key?(:tag)
|
720
|
+
@tense = args[:tense] if args.key?(:tense)
|
721
|
+
@voice = args[:voice] if args.key?(:voice)
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
# Represents a sentence in the input document.
|
726
|
+
class Sentence
|
727
|
+
include Google::Apis::Core::Hashable
|
728
|
+
|
729
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
730
|
+
# Next ID: 6
|
731
|
+
# Corresponds to the JSON property `sentiment`
|
732
|
+
# @return [Google::Apis::LanguageV1beta2::Sentiment]
|
733
|
+
attr_accessor :sentiment
|
734
|
+
|
735
|
+
# Represents an output piece of text.
|
736
|
+
# Corresponds to the JSON property `text`
|
737
|
+
# @return [Google::Apis::LanguageV1beta2::TextSpan]
|
738
|
+
attr_accessor :text
|
739
|
+
|
740
|
+
def initialize(**args)
|
741
|
+
update!(**args)
|
742
|
+
end
|
743
|
+
|
744
|
+
# Update properties of this object
|
745
|
+
def update!(**args)
|
746
|
+
@sentiment = args[:sentiment] if args.key?(:sentiment)
|
747
|
+
@text = args[:text] if args.key?(:text)
|
748
|
+
end
|
749
|
+
end
|
750
|
+
|
751
|
+
# Represents the feeling associated with the entire text or entities in the text.
|
752
|
+
# Next ID: 6
|
753
|
+
class Sentiment
|
754
|
+
include Google::Apis::Core::Hashable
|
755
|
+
|
756
|
+
# A non-negative number in the [0, +inf) range, which represents the absolute
|
757
|
+
# magnitude of sentiment regardless of score (positive or negative).
|
758
|
+
# Corresponds to the JSON property `magnitude`
|
759
|
+
# @return [Float]
|
760
|
+
attr_accessor :magnitude
|
761
|
+
|
762
|
+
# Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
|
763
|
+
# Corresponds to the JSON property `score`
|
764
|
+
# @return [Float]
|
765
|
+
attr_accessor :score
|
766
|
+
|
767
|
+
def initialize(**args)
|
768
|
+
update!(**args)
|
769
|
+
end
|
770
|
+
|
771
|
+
# Update properties of this object
|
772
|
+
def update!(**args)
|
773
|
+
@magnitude = args[:magnitude] if args.key?(:magnitude)
|
774
|
+
@score = args[:score] if args.key?(:score)
|
775
|
+
end
|
776
|
+
end
|
777
|
+
|
778
|
+
# The `Status` type defines a logical error model that is suitable for different
|
779
|
+
# programming environments, including REST APIs and RPC APIs. It is used by [
|
780
|
+
# gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
|
781
|
+
# data: error code, error message, and error details. You can find out more
|
782
|
+
# about this error model and how to work with it in the [API Design Guide](https:
|
783
|
+
# //cloud.google.com/apis/design/errors).
|
784
|
+
class Status
|
785
|
+
include Google::Apis::Core::Hashable
|
786
|
+
|
787
|
+
# The status code, which should be an enum value of google.rpc.Code.
|
788
|
+
# Corresponds to the JSON property `code`
|
789
|
+
# @return [Fixnum]
|
790
|
+
attr_accessor :code
|
791
|
+
|
792
|
+
# A list of messages that carry the error details. There is a common set of
|
793
|
+
# message types for APIs to use.
|
794
|
+
# Corresponds to the JSON property `details`
|
795
|
+
# @return [Array<Hash<String,Object>>]
|
796
|
+
attr_accessor :details
|
797
|
+
|
798
|
+
# A developer-facing error message, which should be in English. Any user-facing
|
799
|
+
# error message should be localized and sent in the google.rpc.Status.details
|
800
|
+
# field, or localized by the client.
|
801
|
+
# Corresponds to the JSON property `message`
|
802
|
+
# @return [String]
|
803
|
+
attr_accessor :message
|
804
|
+
|
805
|
+
def initialize(**args)
|
806
|
+
update!(**args)
|
807
|
+
end
|
808
|
+
|
809
|
+
# Update properties of this object
|
810
|
+
def update!(**args)
|
811
|
+
@code = args[:code] if args.key?(:code)
|
812
|
+
@details = args[:details] if args.key?(:details)
|
813
|
+
@message = args[:message] if args.key?(:message)
|
814
|
+
end
|
815
|
+
end
|
816
|
+
|
817
|
+
# Represents an output piece of text.
|
818
|
+
class TextSpan
|
819
|
+
include Google::Apis::Core::Hashable
|
820
|
+
|
821
|
+
# The API calculates the beginning offset of the content in the original
|
822
|
+
# document according to the EncodingType specified in the API request.
|
823
|
+
# Corresponds to the JSON property `beginOffset`
|
824
|
+
# @return [Fixnum]
|
825
|
+
attr_accessor :begin_offset
|
826
|
+
|
827
|
+
# The content of the output text.
|
828
|
+
# Corresponds to the JSON property `content`
|
829
|
+
# @return [String]
|
830
|
+
attr_accessor :content
|
831
|
+
|
832
|
+
def initialize(**args)
|
833
|
+
update!(**args)
|
834
|
+
end
|
835
|
+
|
836
|
+
# Update properties of this object
|
837
|
+
def update!(**args)
|
838
|
+
@begin_offset = args[:begin_offset] if args.key?(:begin_offset)
|
839
|
+
@content = args[:content] if args.key?(:content)
|
840
|
+
end
|
841
|
+
end
|
842
|
+
|
843
|
+
# Represents the smallest syntactic building block of the text.
|
844
|
+
class Token
|
845
|
+
include Google::Apis::Core::Hashable
|
846
|
+
|
847
|
+
# Represents dependency parse tree information for a token.
|
848
|
+
# Corresponds to the JSON property `dependencyEdge`
|
849
|
+
# @return [Google::Apis::LanguageV1beta2::DependencyEdge]
|
850
|
+
attr_accessor :dependency_edge
|
851
|
+
|
852
|
+
# [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
|
853
|
+
# Corresponds to the JSON property `lemma`
|
854
|
+
# @return [String]
|
855
|
+
attr_accessor :lemma
|
856
|
+
|
857
|
+
# Represents part of speech information for a token.
|
858
|
+
# Corresponds to the JSON property `partOfSpeech`
|
859
|
+
# @return [Google::Apis::LanguageV1beta2::PartOfSpeech]
|
860
|
+
attr_accessor :part_of_speech
|
861
|
+
|
862
|
+
# Represents an output piece of text.
|
863
|
+
# Corresponds to the JSON property `text`
|
864
|
+
# @return [Google::Apis::LanguageV1beta2::TextSpan]
|
865
|
+
attr_accessor :text
|
866
|
+
|
867
|
+
def initialize(**args)
|
868
|
+
update!(**args)
|
869
|
+
end
|
870
|
+
|
871
|
+
# Update properties of this object
|
872
|
+
def update!(**args)
|
873
|
+
@dependency_edge = args[:dependency_edge] if args.key?(:dependency_edge)
|
874
|
+
@lemma = args[:lemma] if args.key?(:lemma)
|
875
|
+
@part_of_speech = args[:part_of_speech] if args.key?(:part_of_speech)
|
876
|
+
@text = args[:text] if args.key?(:text)
|
877
|
+
end
|
878
|
+
end
|
879
|
+
end
|
880
|
+
end
|
881
|
+
end
|