Class: Google::Cloud::Language::Annotation::Entities
- Inherits:
-
Array
- Object
- Array
- Google::Cloud::Language::Annotation::Entities
- Defined in:
- lib/google/cloud/language/annotation.rb
Overview
The entities returned by entity analysis.
Instance Attribute Summary collapse
-
#language ⇒ String
The language of the document (if not specified, the language is automatically detected).
Class Method Summary collapse
-
.from_grpc(grpc) ⇒ Object
V1beta1::AnalyzeEntitiesResponse object.
Instance Method Summary collapse
-
#artwork ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:WORK_OF_ART`.
-
#events ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:EVENT`.
-
#goods ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:CONSUMER_GOOD`.
-
#initialize(entities = [], language = nil) ⇒ Entities
constructor
A new instance of Entities.
-
#locations ⇒ Array<Entity>
(also: #places)
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:LOCATION`.
-
#organizations ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:ORGANIZATION`.
-
#other ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:OTHER`.
-
#people ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:PERSON`.
-
#unknown ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:UNKNOWN`.
Constructor Details
#initialize(entities = [], language = nil) ⇒ Entities
Returns a new instance of Entities.
347 348 349 350 |
# File 'lib/google/cloud/language/annotation.rb', line 347 def initialize entities = [], language = nil super entities @language = language end |
Instance Attribute Details
#language ⇒ String
The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are supported.
342 343 344 |
# File 'lib/google/cloud/language/annotation.rb', line 342 def language @language end |
Class Method Details
Instance Method Details
#artwork ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:WORK_OF_ART`.
403 404 405 |
# File 'lib/google/cloud/language/annotation.rb', line 403 def artwork select(&:artwork?) end |
#events ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:EVENT`.
394 395 396 |
# File 'lib/google/cloud/language/annotation.rb', line 394 def events select(&:event?) end |
#goods ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:CONSUMER_GOOD`.
412 413 414 |
# File 'lib/google/cloud/language/annotation.rb', line 412 def goods select(&:good?) end |
#locations ⇒ Array<Entity> Also known as: places
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:LOCATION`.
375 376 377 |
# File 'lib/google/cloud/language/annotation.rb', line 375 def locations select(&:location?) end |
#organizations ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:ORGANIZATION`.
385 386 387 |
# File 'lib/google/cloud/language/annotation.rb', line 385 def organizations select(&:organization?) end |
#other ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:OTHER`.
421 422 423 |
# File 'lib/google/cloud/language/annotation.rb', line 421 def other select(&:other?) end |
#people ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:PERSON`.
366 367 368 |
# File 'lib/google/cloud/language/annotation.rb', line 366 def people select(&:person?) end |
#unknown ⇒ Array<Entity>
Returns the entities for which Google::Cloud::Language::Annotation::Entity#type is ‘:UNKNOWN`.
357 358 359 |
# File 'lib/google/cloud/language/annotation.rb', line 357 def unknown select(&:unknown?) end |