Class: Google::Cloud::Language::Annotation
- Inherits:
-
Object
- Object
- Google::Cloud::Language::Annotation
- Defined in:
- lib/google/cloud/language/annotation.rb
Overview
Annotation
The results of all requested document analysis features.
See Project#annotate and Document#annotate.
Defined Under Namespace
Classes: Entities, Entity, PartOfSpeech, Sentence, Sentiment, Syntax, TextSpan, Token
Instance Method Summary collapse
-
#entities ⇒ Entities
The entities returned by entity analysis.
-
#language ⇒ String
The language of the document (if not specified, the language is automatically detected).
-
#sentences ⇒ Array<TextSpan>
The sentences returned by syntactic analysis.
-
#sentiment ⇒ Sentiment
The result of sentiment analysis.
-
#syntax ⇒ Syntax
The result of syntax analysis.
-
#tokens ⇒ Array<Token>
The tokens returned by syntactic analysis.
Instance Method Details
#entities ⇒ Entities
The entities returned by entity analysis.
168 169 170 |
# File 'lib/google/cloud/language/annotation.rb', line 168 def entities @entities ||= Entities.from_grpc @grpc end |
#language ⇒ String
The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are supported.
217 218 219 |
# File 'lib/google/cloud/language/annotation.rb', line 217 def language @grpc.language end |
#sentences ⇒ Array<TextSpan>
The sentences returned by syntactic analysis.
74 75 76 |
# File 'lib/google/cloud/language/annotation.rb', line 74 def sentences @sentences ||= Array(grpc.sentences).map { |g| Sentence.from_grpc g } end |
#sentiment ⇒ Sentiment
The result of sentiment analysis.
195 196 197 198 |
# File 'lib/google/cloud/language/annotation.rb', line 195 def sentiment return nil if @grpc.document_sentiment.nil? @sentiment ||= Sentiment.from_grpc @grpc end |