google-cloud-language 0.31.2 → 0.32.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d44cbf98e55497d915bc84a64afe5e84495035ef0a87cdcde099cba7dbaac749
4
- data.tar.gz: 86a9b5ec0bd8381e3f7f3d58f18836385dafb1dbca73b3c7aff886678958a169
3
+ metadata.gz: 4aafb9034eaba005613dd083da7f3af843366d98c7f049eb67e2c17731dc0938
4
+ data.tar.gz: 21332829389d31c94b8560f3018defc8a5656720c18ea273025173e0794bac7b
5
5
  SHA512:
6
- metadata.gz: c37aa26c4ef5c4a406c07f8ca682287ea556551fa82239b2d2c888c8a00ab560d5633e92b5eecd2783f89f65125262c362a8bad948f5239c0a69e8282e5c6aef
7
- data.tar.gz: fee3c8fb36c79d9e10f2ffd2ee8462684da2974c8b99482f94c46748a271386d35817266f35f96037d0c1a4f9e8a0a47ce9996cc7cbc373cbe9d4a23d0b3bdb8
6
+ metadata.gz: 2c4c803d81e7a924724afd8ff6a5a8d2b24a6fe4cc9d8c1fbc9f13c1fff9f3727da475602e7f7d1ec3a40fa6f9bd26e16f96388c91f0df598cf785f50b260372
7
+ data.tar.gz: 1f2afb0b2fb5cf2fcbd14223022e3ebc2b5faaa324cdbdf8bbda30f2a7d30187e7508ea791a2a088acb088ed442d72868e3ea93ac199da8293115458df4a338e
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Google Cloud Natural Language API
2
+ --title=Cloud Natural Language API
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # Ruby Client for Google Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
1
+ # Ruby Client for Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
2
2
 
3
- [Google Cloud Natural Language API][Product Documentation]:
4
- Google Cloud Natural Language API provides natural language understanding
5
- technologies to developers. Examples include sentiment analysis, entity
6
- recognition, and text annotations.
3
+ [Cloud Natural Language API][Product Documentation]:
4
+ Provides natural language understanding technologies, such as sentiment
5
+ analysis, entity recognition, entity sentiment analysis, and other text
6
+ annotations, to developers.
7
7
  - [Client Library Documentation][]
8
8
  - [Product Documentation][]
9
9
 
@@ -13,7 +13,7 @@ steps:
13
13
 
14
14
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
15
15
  2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
16
- 3. [Enable the Google Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
16
+ 3. [Enable the Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
17
17
  4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
18
18
 
19
19
  ### Installation
@@ -21,22 +21,10 @@ steps:
21
21
  $ gem install google-cloud-language
22
22
  ```
23
23
 
24
- ### Preview
25
- #### LanguageServiceClient
26
- ```rb
27
- require "google/cloud/language"
28
-
29
- language_service_client = Google::Cloud::Language.new
30
- content = "Hello, world!"
31
- type = :PLAIN_TEXT
32
- document = { content: content, type: type }
33
- response = language_service_client.analyze_sentiment(document)
34
- ```
35
-
36
24
  ### Next Steps
37
- - Read the [Client Library Documentation][] for Google Cloud Natural Language API
25
+ - Read the [Client Library Documentation][] for Cloud Natural Language API
38
26
  to see other available methods on the client.
39
- - Read the [Google Cloud Natural Language API Product documentation][Product Documentation]
27
+ - Read the [Cloud Natural Language API Product documentation][Product Documentation]
40
28
  to learn more about the product and see How-to Guides.
41
29
  - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
42
30
  to see the full list of Cloud APIs that we cover.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -21,12 +21,12 @@ module Google
21
21
  # rubocop:disable LineLength
22
22
 
23
23
  ##
24
- # # Ruby Client for Google Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
24
+ # # Ruby Client for Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
25
25
  #
26
- # [Google Cloud Natural Language API][Product Documentation]:
27
- # Google Cloud Natural Language API provides natural language understanding
28
- # technologies to developers. Examples include sentiment analysis, entity
29
- # recognition, and text annotations.
26
+ # [Cloud Natural Language API][Product Documentation]:
27
+ # Provides natural language understanding technologies, such as sentiment
28
+ # analysis, entity recognition, entity sentiment analysis, and other text
29
+ # annotations, to developers.
30
30
  # - [Product Documentation][]
31
31
  #
32
32
  # ## Quick Start
@@ -35,7 +35,7 @@ module Google
35
35
  #
36
36
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
37
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Google Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
38
+ # 3. [Enable the Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
39
39
  # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
40
40
  #
41
41
  # ### Installation
@@ -43,20 +43,8 @@ module Google
43
43
  # $ gem install google-cloud-language
44
44
  # ```
45
45
  #
46
- # ### Preview
47
- # #### LanguageServiceClient
48
- # ```rb
49
- # require "google/cloud/language"
50
- #
51
- # language_service_client = Google::Cloud::Language.new
52
- # content = "Hello, world!"
53
- # type = :PLAIN_TEXT
54
- # document = { content: content, type: type }
55
- # response = language_service_client.analyze_sentiment(document)
56
- # ```
57
- #
58
46
  # ### Next Steps
59
- # - Read the [Google Cloud Natural Language API Product documentation][Product Documentation]
47
+ # - Read the [Cloud Natural Language API Product documentation][Product Documentation]
60
48
  # to learn more about the product and see How-to Guides.
61
49
  # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
62
50
  # to see the full list of Cloud APIs that we cover.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -21,12 +21,12 @@ module Google
21
21
  # rubocop:disable LineLength
22
22
 
23
23
  ##
24
- # # Ruby Client for Google Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
24
+ # # Ruby Client for Cloud Natural Language API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
25
25
  #
26
- # [Google Cloud Natural Language API][Product Documentation]:
27
- # Google Cloud Natural Language API provides natural language understanding
28
- # technologies to developers. Examples include sentiment analysis, entity
29
- # recognition, and text annotations.
26
+ # [Cloud Natural Language API][Product Documentation]:
27
+ # Provides natural language understanding technologies, such as sentiment
28
+ # analysis, entity recognition, entity sentiment analysis, and other text
29
+ # annotations, to developers.
30
30
  # - [Product Documentation][]
31
31
  #
32
32
  # ## Quick Start
@@ -35,7 +35,7 @@ module Google
35
35
  #
36
36
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
37
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Google Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
38
+ # 3. [Enable the Cloud Natural Language API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
39
39
  # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
40
40
  #
41
41
  # ### Installation
@@ -43,20 +43,8 @@ module Google
43
43
  # $ gem install google-cloud-language
44
44
  # ```
45
45
  #
46
- # ### Preview
47
- # #### LanguageServiceClient
48
- # ```rb
49
- # require "google/cloud/language"
50
- #
51
- # language_service_client = Google::Cloud::Language.new(version: :v1)
52
- # content = "Hello, world!"
53
- # type = :PLAIN_TEXT
54
- # document = { content: content, type: type }
55
- # response = language_service_client.analyze_sentiment(document)
56
- # ```
57
- #
58
46
  # ### Next Steps
59
- # - Read the [Google Cloud Natural Language API Product documentation][Product Documentation]
47
+ # - Read the [Cloud Natural Language API Product documentation][Product Documentation]
60
48
  # to learn more about the product and see How-to Guides.
61
49
  # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
62
50
  # to see the full list of Cloud APIs that we cover.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -64,8 +64,8 @@ module Google
64
64
  # @!attribute [rw] sentiment
65
65
  # @return [Google::Cloud::Language::V1::Sentiment]
66
66
  # For calls to {AnalyzeSentiment} or if
67
- # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment} is set to
68
- # true, this field will contain the sentiment for the sentence.
67
+ # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment}
68
+ # is set to true, this field will contain the sentiment for the sentence.
69
69
  class Sentence; end
70
70
 
71
71
  # Represents a phrase in the text that is a known entity, such as
@@ -98,9 +98,9 @@ module Google
98
98
  # @!attribute [rw] sentiment
99
99
  # @return [Google::Cloud::Language::V1::Sentiment]
100
100
  # For calls to {AnalyzeEntitySentiment} or if
101
- # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
102
- # true, this field will contain the aggregate sentiment expressed for this
103
- # entity in the provided document.
101
+ # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment}
102
+ # is set to true, this field will contain the aggregate sentiment expressed
103
+ # for this entity in the provided document.
104
104
  class Entity
105
105
  # The type of the entity.
106
106
  module Type
@@ -127,6 +127,21 @@ module Google
127
127
 
128
128
  # Other types
129
129
  OTHER = 7
130
+
131
+ # Phone number
132
+ PHONE_NUMBER = 9
133
+
134
+ # Address
135
+ ADDRESS = 10
136
+
137
+ # Date
138
+ DATE = 11
139
+
140
+ # Number
141
+ NUMBER = 12
142
+
143
+ # Price
144
+ PRICE = 13
130
145
  end
131
146
  end
132
147
 
@@ -198,51 +213,6 @@ module Google
198
213
  # @return [Google::Cloud::Language::V1::PartOfSpeech::Voice]
199
214
  # The grammatical voice.
200
215
  class PartOfSpeech
201
- # The part of speech tags enum.
202
- module Tag
203
- # Unknown
204
- UNKNOWN = 0
205
-
206
- # Adjective
207
- ADJ = 1
208
-
209
- # Adposition (preposition and postposition)
210
- ADP = 2
211
-
212
- # Adverb
213
- ADV = 3
214
-
215
- # Conjunction
216
- CONJ = 4
217
-
218
- # Determiner
219
- DET = 5
220
-
221
- # Noun (common and proper)
222
- NOUN = 6
223
-
224
- # Cardinal number
225
- NUM = 7
226
-
227
- # Pronoun
228
- PRON = 8
229
-
230
- # Particle or other function word
231
- PRT = 9
232
-
233
- # Punctuation
234
- PUNCT = 10
235
-
236
- # Verb (all tenses and modes)
237
- VERB = 11
238
-
239
- # Other: foreign words, typos, abbreviations
240
- X = 12
241
-
242
- # Affix
243
- AFFIX = 13
244
- end
245
-
246
216
  # The characteristic of a verb that expresses time flow during an event.
247
217
  module Aspect
248
218
  # Aspect is not applicable in the analyzed language or is not predicted.
@@ -447,6 +417,51 @@ module Google
447
417
  NON_RECIPROCAL = 2
448
418
  end
449
419
 
420
+ # The part of speech tags enum.
421
+ module Tag
422
+ # Unknown
423
+ UNKNOWN = 0
424
+
425
+ # Adjective
426
+ ADJ = 1
427
+
428
+ # Adposition (preposition and postposition)
429
+ ADP = 2
430
+
431
+ # Adverb
432
+ ADV = 3
433
+
434
+ # Conjunction
435
+ CONJ = 4
436
+
437
+ # Determiner
438
+ DET = 5
439
+
440
+ # Noun (common and proper)
441
+ NOUN = 6
442
+
443
+ # Cardinal number
444
+ NUM = 7
445
+
446
+ # Pronoun
447
+ PRON = 8
448
+
449
+ # Particle or other function word
450
+ PRT = 9
451
+
452
+ # Punctuation
453
+ PUNCT = 10
454
+
455
+ # Verb (all tenses and modes)
456
+ VERB = 11
457
+
458
+ # Other: foreign words, typos, abbreviations
459
+ X = 12
460
+
461
+ # Affix
462
+ AFFIX = 13
463
+ end
464
+
450
465
  # Time reference.
451
466
  module Tense
452
467
  # Tense is not applicable in the analyzed language or is not predicted.
@@ -766,9 +781,9 @@ module Google
766
781
  # @!attribute [rw] sentiment
767
782
  # @return [Google::Cloud::Language::V1::Sentiment]
768
783
  # For calls to {AnalyzeEntitySentiment} or if
769
- # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
770
- # true, this field will contain the sentiment expressed for this mention of
771
- # the entity in the provided document.
784
+ # {Google::Cloud::Language::V1::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment}
785
+ # is set to true, this field will contain the sentiment expressed for this
786
+ # mention of the entity in the provided document.
772
787
  class EntityMention
773
788
  # The supported types of mentions.
774
789
  module Type
@@ -790,13 +805,16 @@ module Google
790
805
  # @!attribute [rw] begin_offset
791
806
  # @return [Integer]
792
807
  # The API calculates the beginning offset of the content in the original
793
- # document according to the {Google::Cloud::Language::V1::EncodingType EncodingType} specified in the API request.
808
+ # document according to the
809
+ # {Google::Cloud::Language::V1::EncodingType EncodingType} specified in the API
810
+ # request.
794
811
  class TextSpan; end
795
812
 
796
813
  # Represents a category returned from the text classifier.
797
814
  # @!attribute [rw] name
798
815
  # @return [String]
799
- # The name of the category representing the document.
816
+ # The name of the category representing the document, from the [predefined
817
+ # taxonomy](/natural-language/docs/categories).
800
818
  # @!attribute [rw] confidence
801
819
  # @return [Float]
802
820
  # The classifier's confidence of the category. Number represents how certain
@@ -820,7 +838,8 @@ module Google
820
838
  # @return [String]
821
839
  # The language of the text, which will be the same as the language specified
822
840
  # in the request or, if not specified, the automatically-detected language.
823
- # See {Google::Cloud::Language::V1::Document#language Document#language} field for more details.
841
+ # See {Google::Cloud::Language::V1::Document#language Document#language} field
842
+ # for more details.
824
843
  # @!attribute [rw] sentences
825
844
  # @return [Array<Google::Cloud::Language::V1::Sentence>]
826
845
  # The sentiment for all the sentences in the document.
@@ -843,7 +862,8 @@ module Google
843
862
  # @return [String]
844
863
  # The language of the text, which will be the same as the language specified
845
864
  # in the request or, if not specified, the automatically-detected language.
846
- # See {Google::Cloud::Language::V1::Document#language Document#language} field for more details.
865
+ # See {Google::Cloud::Language::V1::Document#language Document#language} field
866
+ # for more details.
847
867
  class AnalyzeEntitySentimentResponse; end
848
868
 
849
869
  # The entity analysis request message.
@@ -863,7 +883,8 @@ module Google
863
883
  # @return [String]
864
884
  # The language of the text, which will be the same as the language specified
865
885
  # in the request or, if not specified, the automatically-detected language.
866
- # See {Google::Cloud::Language::V1::Document#language Document#language} field for more details.
886
+ # See {Google::Cloud::Language::V1::Document#language Document#language} field
887
+ # for more details.
867
888
  class AnalyzeEntitiesResponse; end
868
889
 
869
890
  # The syntax analysis request message.
@@ -886,7 +907,8 @@ module Google
886
907
  # @return [String]
887
908
  # The language of the text, which will be the same as the language specified
888
909
  # in the request or, if not specified, the automatically-detected language.
889
- # See {Google::Cloud::Language::V1::Document#language Document#language} field for more details.
910
+ # See {Google::Cloud::Language::V1::Document#language Document#language} field
911
+ # for more details.
890
912
  class AnalyzeSyntaxResponse; end
891
913
 
892
914
  # The document classification request message.
@@ -956,7 +978,8 @@ module Google
956
978
  # @return [String]
957
979
  # The language of the text, which will be the same as the language specified
958
980
  # in the request or, if not specified, the automatically-detected language.
959
- # See {Google::Cloud::Language::V1::Document#language Document#language} field for more details.
981
+ # See {Google::Cloud::Language::V1::Document#language Document#language} field
982
+ # for more details.
960
983
  # @!attribute [rw] categories
961
984
  # @return [Array<Google::Cloud::Language::V1::ClassificationCategory>]
962
985
  # Categories identified in the input document.
@@ -978,7 +1001,7 @@ module Google
978
1001
  UTF8 = 1
979
1002
 
980
1003
  # Encoding-dependent information (such as `begin_offset`) is calculated based
981
- # on the UTF-16 encoding of the input. Java and Javascript are examples of
1004
+ # on the UTF-16 encoding of the input. Java and JavaScript are examples of
982
1005
  # languages that use this encoding natively.
983
1006
  UTF16 = 2
984
1007
 
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -55,6 +55,7 @@ module Google
55
55
  # The scopes needed to make gRPC calls to all of the methods defined in
56
56
  # this service.
57
57
  ALL_SCOPES = [
58
+ "https://www.googleapis.com/auth/cloud-language",
58
59
  "https://www.googleapis.com/auth/cloud-platform"
59
60
  ].freeze
60
61
 
@@ -214,11 +215,11 @@ module Google
214
215
  # @example
215
216
  # require "google/cloud/language"
216
217
  #
217
- # language_service_client = Google::Cloud::Language.new(version: :v1)
218
+ # language_client = Google::Cloud::Language.new(version: :v1)
218
219
  #
219
220
  # # TODO: Initialize `document`:
220
221
  # document = {}
221
- # response = language_service_client.analyze_sentiment(document)
222
+ # response = language_client.analyze_sentiment(document)
222
223
 
223
224
  def analyze_sentiment \
224
225
  document,
@@ -254,11 +255,11 @@ module Google
254
255
  # @example
255
256
  # require "google/cloud/language"
256
257
  #
257
- # language_service_client = Google::Cloud::Language.new(version: :v1)
258
+ # language_client = Google::Cloud::Language.new(version: :v1)
258
259
  #
259
260
  # # TODO: Initialize `document`:
260
261
  # document = {}
261
- # response = language_service_client.analyze_entities(document)
262
+ # response = language_client.analyze_entities(document)
262
263
 
263
264
  def analyze_entities \
264
265
  document,
@@ -273,8 +274,10 @@ module Google
273
274
  @analyze_entities.call(req, options, &block)
274
275
  end
275
276
 
276
- # Finds entities, similar to {Google::Cloud::Language::V1::LanguageService::AnalyzeEntities AnalyzeEntities} in the text and analyzes
277
- # sentiment associated with each entity and its mentions.
277
+ # Finds entities, similar to
278
+ # {Google::Cloud::Language::V1::LanguageService::AnalyzeEntities AnalyzeEntities}
279
+ # in the text and analyzes sentiment associated with each entity and its
280
+ # mentions.
278
281
  #
279
282
  # @param document [Google::Cloud::Language::V1::Document | Hash]
280
283
  # Input document.
@@ -293,11 +296,11 @@ module Google
293
296
  # @example
294
297
  # require "google/cloud/language"
295
298
  #
296
- # language_service_client = Google::Cloud::Language.new(version: :v1)
299
+ # language_client = Google::Cloud::Language.new(version: :v1)
297
300
  #
298
301
  # # TODO: Initialize `document`:
299
302
  # document = {}
300
- # response = language_service_client.analyze_entity_sentiment(document)
303
+ # response = language_client.analyze_entity_sentiment(document)
301
304
 
302
305
  def analyze_entity_sentiment \
303
306
  document,
@@ -333,11 +336,11 @@ module Google
333
336
  # @example
334
337
  # require "google/cloud/language"
335
338
  #
336
- # language_service_client = Google::Cloud::Language.new(version: :v1)
339
+ # language_client = Google::Cloud::Language.new(version: :v1)
337
340
  #
338
341
  # # TODO: Initialize `document`:
339
342
  # document = {}
340
- # response = language_service_client.analyze_syntax(document)
343
+ # response = language_client.analyze_syntax(document)
341
344
 
342
345
  def analyze_syntax \
343
346
  document,
@@ -369,11 +372,11 @@ module Google
369
372
  # @example
370
373
  # require "google/cloud/language"
371
374
  #
372
- # language_service_client = Google::Cloud::Language.new(version: :v1)
375
+ # language_client = Google::Cloud::Language.new(version: :v1)
373
376
  #
374
377
  # # TODO: Initialize `document`:
375
378
  # document = {}
376
- # response = language_service_client.classify_text(document)
379
+ # response = language_client.classify_text(document)
377
380
 
378
381
  def classify_text \
379
382
  document,
@@ -410,14 +413,14 @@ module Google
410
413
  # @example
411
414
  # require "google/cloud/language"
412
415
  #
413
- # language_service_client = Google::Cloud::Language.new(version: :v1)
416
+ # language_client = Google::Cloud::Language.new(version: :v1)
414
417
  #
415
418
  # # TODO: Initialize `document`:
416
419
  # document = {}
417
420
  #
418
421
  # # TODO: Initialize `features`:
419
422
  # features = {}
420
- # response = language_service_client.annotate_text(document, features)
423
+ # response = language_client.annotate_text(document, features)
421
424
 
422
425
  def annotate_text \
423
426
  document,
@@ -13,40 +13,40 @@
13
13
  "initial_retry_delay_millis": 100,
14
14
  "retry_delay_multiplier": 1.3,
15
15
  "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
17
  "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 60000,
18
+ "max_rpc_timeout_millis": 20000,
19
19
  "total_timeout_millis": 600000
20
20
  }
21
21
  },
22
22
  "methods": {
23
23
  "AnalyzeSentiment": {
24
- "timeout_millis": 30000,
24
+ "timeout_millis": 60000,
25
25
  "retry_codes_name": "idempotent",
26
26
  "retry_params_name": "default"
27
27
  },
28
28
  "AnalyzeEntities": {
29
- "timeout_millis": 30000,
29
+ "timeout_millis": 60000,
30
30
  "retry_codes_name": "idempotent",
31
31
  "retry_params_name": "default"
32
32
  },
33
33
  "AnalyzeEntitySentiment": {
34
- "timeout_millis": 30000,
34
+ "timeout_millis": 60000,
35
35
  "retry_codes_name": "idempotent",
36
36
  "retry_params_name": "default"
37
37
  },
38
38
  "AnalyzeSyntax": {
39
- "timeout_millis": 30000,
39
+ "timeout_millis": 60000,
40
40
  "retry_codes_name": "idempotent",
41
41
  "retry_params_name": "default"
42
42
  },
43
43
  "ClassifyText": {
44
- "timeout_millis": 30000,
44
+ "timeout_millis": 60000,
45
45
  "retry_codes_name": "idempotent",
46
46
  "retry_params_name": "default"
47
47
  },
48
48
  "AnnotateText": {
49
- "timeout_millis": 30000,
49
+ "timeout_millis": 60000,
50
50
  "retry_codes_name": "idempotent",
51
51
  "retry_params_name": "default"
52
52
  }
@@ -40,6 +40,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
40
40
  value :WORK_OF_ART, 5
41
41
  value :CONSUMER_GOOD, 6
42
42
  value :OTHER, 7
43
+ value :PHONE_NUMBER, 9
44
+ value :ADDRESS, 10
45
+ value :DATE, 11
46
+ value :NUMBER, 12
47
+ value :PRICE, 13
43
48
  end
44
49
  add_message "google.cloud.language.v1.Token" do
45
50
  optional :text, :message, 1, "google.cloud.language.v1.TextSpan"
@@ -1,7 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # Source: google/cloud/language/v1/language_service.proto for package 'google.cloud.language.v1'
3
3
  # Original file comments:
4
- # Copyright 2017 Google Inc.
4
+ # Copyright 2019 Google LLC.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+ #
18
19
 
19
20
 
20
21
  require 'grpc'
@@ -41,8 +42,10 @@ module Google
41
42
  # along with entity types, salience, mentions for each entity, and
42
43
  # other properties.
43
44
  rpc :AnalyzeEntities, AnalyzeEntitiesRequest, AnalyzeEntitiesResponse
44
- # Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
45
- # sentiment associated with each entity and its mentions.
45
+ # Finds entities, similar to
46
+ # [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
47
+ # in the text and analyzes sentiment associated with each entity and its
48
+ # mentions.
46
49
  rpc :AnalyzeEntitySentiment, AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse
47
50
  # Analyzes the syntax of the text and provides sentence boundaries and
48
51
  # tokenization along with part of speech tags, dependency trees, and other
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -48,11 +48,11 @@ module Google
48
48
  # ```rb
49
49
  # require "google/cloud/language"
50
50
  #
51
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
51
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
52
52
  # content = "Hello, world!"
53
53
  # type = :PLAIN_TEXT
54
54
  # document = { content: content, type: type }
55
- # response = language_service_client.analyze_sentiment(document)
55
+ # response = language_client.analyze_sentiment(document)
56
56
  # ```
57
57
  #
58
58
  # ### Next Steps
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -64,8 +64,8 @@ module Google
64
64
  # @!attribute [rw] sentiment
65
65
  # @return [Google::Cloud::Language::V1beta2::Sentiment]
66
66
  # For calls to {AnalyzeSentiment} or if
67
- # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment} is set to
68
- # true, this field will contain the sentiment for the sentence.
67
+ # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment}
68
+ # is set to true, this field will contain the sentiment for the sentence.
69
69
  class Sentence; end
70
70
 
71
71
  # Represents a phrase in the text that is a known entity, such as
@@ -98,9 +98,9 @@ module Google
98
98
  # @!attribute [rw] sentiment
99
99
  # @return [Google::Cloud::Language::V1beta2::Sentiment]
100
100
  # For calls to {AnalyzeEntitySentiment} or if
101
- # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
102
- # true, this field will contain the aggregate sentiment expressed for this
103
- # entity in the provided document.
101
+ # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment}
102
+ # is set to true, this field will contain the aggregate sentiment expressed
103
+ # for this entity in the provided document.
104
104
  class Entity
105
105
  # The type of the entity.
106
106
  module Type
@@ -196,51 +196,6 @@ module Google
196
196
  # @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Voice]
197
197
  # The grammatical voice.
198
198
  class PartOfSpeech
199
- # The part of speech tags enum.
200
- module Tag
201
- # Unknown
202
- UNKNOWN = 0
203
-
204
- # Adjective
205
- ADJ = 1
206
-
207
- # Adposition (preposition and postposition)
208
- ADP = 2
209
-
210
- # Adverb
211
- ADV = 3
212
-
213
- # Conjunction
214
- CONJ = 4
215
-
216
- # Determiner
217
- DET = 5
218
-
219
- # Noun (common and proper)
220
- NOUN = 6
221
-
222
- # Cardinal number
223
- NUM = 7
224
-
225
- # Pronoun
226
- PRON = 8
227
-
228
- # Particle or other function word
229
- PRT = 9
230
-
231
- # Punctuation
232
- PUNCT = 10
233
-
234
- # Verb (all tenses and modes)
235
- VERB = 11
236
-
237
- # Other: foreign words, typos, abbreviations
238
- X = 12
239
-
240
- # Affix
241
- AFFIX = 13
242
- end
243
-
244
199
  # The characteristic of a verb that expresses time flow during an event.
245
200
  module Aspect
246
201
  # Aspect is not applicable in the analyzed language or is not predicted.
@@ -445,6 +400,51 @@ module Google
445
400
  NON_RECIPROCAL = 2
446
401
  end
447
402
 
403
+ # The part of speech tags enum.
404
+ module Tag
405
+ # Unknown
406
+ UNKNOWN = 0
407
+
408
+ # Adjective
409
+ ADJ = 1
410
+
411
+ # Adposition (preposition and postposition)
412
+ ADP = 2
413
+
414
+ # Adverb
415
+ ADV = 3
416
+
417
+ # Conjunction
418
+ CONJ = 4
419
+
420
+ # Determiner
421
+ DET = 5
422
+
423
+ # Noun (common and proper)
424
+ NOUN = 6
425
+
426
+ # Cardinal number
427
+ NUM = 7
428
+
429
+ # Pronoun
430
+ PRON = 8
431
+
432
+ # Particle or other function word
433
+ PRT = 9
434
+
435
+ # Punctuation
436
+ PUNCT = 10
437
+
438
+ # Verb (all tenses and modes)
439
+ VERB = 11
440
+
441
+ # Other: foreign words, typos, abbreviations
442
+ X = 12
443
+
444
+ # Affix
445
+ AFFIX = 13
446
+ end
447
+
448
448
  # Time reference.
449
449
  module Tense
450
450
  # Tense is not applicable in the analyzed language or is not predicted.
@@ -762,9 +762,9 @@ module Google
762
762
  # @!attribute [rw] sentiment
763
763
  # @return [Google::Cloud::Language::V1beta2::Sentiment]
764
764
  # For calls to {AnalyzeEntitySentiment} or if
765
- # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
766
- # true, this field will contain the sentiment expressed for this mention of
767
- # the entity in the provided document.
765
+ # {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment}
766
+ # is set to true, this field will contain the sentiment expressed for this
767
+ # mention of the entity in the provided document.
768
768
  class EntityMention
769
769
  # The supported types of mentions.
770
770
  module Type
@@ -786,7 +786,9 @@ module Google
786
786
  # @!attribute [rw] begin_offset
787
787
  # @return [Integer]
788
788
  # The API calculates the beginning offset of the content in the original
789
- # document according to the {Google::Cloud::Language::V1beta2::EncodingType EncodingType} specified in the API request.
789
+ # document according to the
790
+ # {Google::Cloud::Language::V1beta2::EncodingType EncodingType} specified in the
791
+ # API request.
790
792
  class TextSpan; end
791
793
 
792
794
  # Represents a category returned from the text classifier.
@@ -817,7 +819,8 @@ module Google
817
819
  # @return [String]
818
820
  # The language of the text, which will be the same as the language specified
819
821
  # in the request or, if not specified, the automatically-detected language.
820
- # See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
822
+ # See {Google::Cloud::Language::V1beta2::Document#language Document#language}
823
+ # field for more details.
821
824
  # @!attribute [rw] sentences
822
825
  # @return [Array<Google::Cloud::Language::V1beta2::Sentence>]
823
826
  # The sentiment for all the sentences in the document.
@@ -840,7 +843,8 @@ module Google
840
843
  # @return [String]
841
844
  # The language of the text, which will be the same as the language specified
842
845
  # in the request or, if not specified, the automatically-detected language.
843
- # See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
846
+ # See {Google::Cloud::Language::V1beta2::Document#language Document#language}
847
+ # field for more details.
844
848
  class AnalyzeEntitySentimentResponse; end
845
849
 
846
850
  # The entity analysis request message.
@@ -860,7 +864,8 @@ module Google
860
864
  # @return [String]
861
865
  # The language of the text, which will be the same as the language specified
862
866
  # in the request or, if not specified, the automatically-detected language.
863
- # See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
867
+ # See {Google::Cloud::Language::V1beta2::Document#language Document#language}
868
+ # field for more details.
864
869
  class AnalyzeEntitiesResponse; end
865
870
 
866
871
  # The syntax analysis request message.
@@ -883,7 +888,8 @@ module Google
883
888
  # @return [String]
884
889
  # The language of the text, which will be the same as the language specified
885
890
  # in the request or, if not specified, the automatically-detected language.
886
- # See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
891
+ # See {Google::Cloud::Language::V1beta2::Document#language Document#language}
892
+ # field for more details.
887
893
  class AnalyzeSyntaxResponse; end
888
894
 
889
895
  # The document classification request message.
@@ -953,7 +959,8 @@ module Google
953
959
  # @return [String]
954
960
  # The language of the text, which will be the same as the language specified
955
961
  # in the request or, if not specified, the automatically-detected language.
956
- # See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
962
+ # See {Google::Cloud::Language::V1beta2::Document#language Document#language}
963
+ # field for more details.
957
964
  # @!attribute [rw] categories
958
965
  # @return [Array<Google::Cloud::Language::V1beta2::ClassificationCategory>]
959
966
  # Categories identified in the input document.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -215,11 +215,11 @@ module Google
215
215
  # @example
216
216
  # require "google/cloud/language"
217
217
  #
218
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
218
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
219
219
  #
220
220
  # # TODO: Initialize `document`:
221
221
  # document = {}
222
- # response = language_service_client.analyze_sentiment(document)
222
+ # response = language_client.analyze_sentiment(document)
223
223
 
224
224
  def analyze_sentiment \
225
225
  document,
@@ -255,11 +255,11 @@ module Google
255
255
  # @example
256
256
  # require "google/cloud/language"
257
257
  #
258
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
258
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
259
259
  #
260
260
  # # TODO: Initialize `document`:
261
261
  # document = {}
262
- # response = language_service_client.analyze_entities(document)
262
+ # response = language_client.analyze_entities(document)
263
263
 
264
264
  def analyze_entities \
265
265
  document,
@@ -274,8 +274,10 @@ module Google
274
274
  @analyze_entities.call(req, options, &block)
275
275
  end
276
276
 
277
- # Finds entities, similar to {Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntities AnalyzeEntities} in the text and analyzes
278
- # sentiment associated with each entity and its mentions.
277
+ # Finds entities, similar to
278
+ # {Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntities AnalyzeEntities}
279
+ # in the text and analyzes sentiment associated with each entity and its
280
+ # mentions.
279
281
  #
280
282
  # @param document [Google::Cloud::Language::V1beta2::Document | Hash]
281
283
  # Input document.
@@ -294,11 +296,11 @@ module Google
294
296
  # @example
295
297
  # require "google/cloud/language"
296
298
  #
297
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
299
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
298
300
  #
299
301
  # # TODO: Initialize `document`:
300
302
  # document = {}
301
- # response = language_service_client.analyze_entity_sentiment(document)
303
+ # response = language_client.analyze_entity_sentiment(document)
302
304
 
303
305
  def analyze_entity_sentiment \
304
306
  document,
@@ -334,11 +336,11 @@ module Google
334
336
  # @example
335
337
  # require "google/cloud/language"
336
338
  #
337
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
339
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
338
340
  #
339
341
  # # TODO: Initialize `document`:
340
342
  # document = {}
341
- # response = language_service_client.analyze_syntax(document)
343
+ # response = language_client.analyze_syntax(document)
342
344
 
343
345
  def analyze_syntax \
344
346
  document,
@@ -370,11 +372,11 @@ module Google
370
372
  # @example
371
373
  # require "google/cloud/language"
372
374
  #
373
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
375
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
374
376
  #
375
377
  # # TODO: Initialize `document`:
376
378
  # document = {}
377
- # response = language_service_client.classify_text(document)
379
+ # response = language_client.classify_text(document)
378
380
 
379
381
  def classify_text \
380
382
  document,
@@ -411,14 +413,14 @@ module Google
411
413
  # @example
412
414
  # require "google/cloud/language"
413
415
  #
414
- # language_service_client = Google::Cloud::Language.new(version: :v1beta2)
416
+ # language_client = Google::Cloud::Language.new(version: :v1beta2)
415
417
  #
416
418
  # # TODO: Initialize `document`:
417
419
  # document = {}
418
420
  #
419
421
  # # TODO: Initialize `features`:
420
422
  # features = {}
421
- # response = language_service_client.annotate_text(document, features)
423
+ # response = language_client.annotate_text(document, features)
422
424
 
423
425
  def annotate_text \
424
426
  document,
@@ -41,8 +41,10 @@ module Google
41
41
  # along with entity types, salience, mentions for each entity, and
42
42
  # other properties.
43
43
  rpc :AnalyzeEntities, AnalyzeEntitiesRequest, AnalyzeEntitiesResponse
44
- # Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
45
- # sentiment associated with each entity and its mentions.
44
+ # Finds entities, similar to
45
+ # [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities]
46
+ # in the text and analyzes sentiment associated with each entity and its
47
+ # mentions.
46
48
  rpc :AnalyzeEntitySentiment, AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse
47
49
  # Analyzes the syntax of the text and provides sentence boundaries and
48
50
  # tokenization along with part of speech tags, dependency trees, and other
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.2
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-21 00:00:00.000000000 Z
11
+ date: 2019-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.50.0
61
+ version: 0.64.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.50.0
68
+ version: 0.64.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,8 +94,8 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.9'
97
- description: google-cloud-language is the official library for Google Cloud Natural
98
- Language API.
97
+ description: google-cloud-language is the official library for Cloud Natural Language
98
+ API.
99
99
  email: googleapis-packages@google.com
100
100
  executables: []
101
101
  extensions: []
@@ -138,9 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.7.7
141
+ rubygems_version: 3.0.3
143
142
  signing_key:
144
143
  specification_version: 4
145
- summary: API Client library for Google Cloud Natural Language API
144
+ summary: API Client library for Cloud Natural Language API
146
145
  test_files: []