Class: Google::Cloud::Language::Annotation::Token
- Inherits:
-
Object
- Object
- Google::Cloud::Language::Annotation::Token
- Defined in:
- lib/google/cloud/language/annotation.rb
Overview
Represents the smallest syntactic building block of the text. Returned by syntactic analysis.
Instance Attribute Summary collapse
-
#head_token_index ⇒ Integer
readonly
Represents the head of this token in the dependency tree.
-
#label ⇒ Symbol
readonly
The parse label for the token.
-
#lemma ⇒ String
readonly
Lemma of the token.
-
#part_of_speech ⇒ PartOfSpeech
readonly
Represents part of speech information for a token.
-
#text_span ⇒ TextSpan
readonly
The token text.
Instance Method Summary collapse
- #offset ⇒ Object (also: #begin_offset)
- #text ⇒ Object (also: #content)
Instance Attribute Details
#head_token_index ⇒ Integer (readonly)
Represents the head of this token in the dependency tree. This is the index of the token which has an arc going to this token. The index is the position of the token in the array of tokens returned by the API method. If this token is a root token, then the headTokenIndex is its own index.
523 524 525 |
# File 'lib/google/cloud/language/annotation.rb', line 523 def head_token_index @head_token_index end |
#label ⇒ Symbol (readonly)
The parse label for the token.
523 524 525 |
# File 'lib/google/cloud/language/annotation.rb', line 523 def label @label end |
#lemma ⇒ String (readonly)
Lemma of the token.
523 524 525 |
# File 'lib/google/cloud/language/annotation.rb', line 523 def lemma @lemma end |
#part_of_speech ⇒ PartOfSpeech (readonly)
Represents part of speech information for a token.
523 524 525 |
# File 'lib/google/cloud/language/annotation.rb', line 523 def part_of_speech @part_of_speech end |
#text_span ⇒ TextSpan (readonly)
The token text.
523 524 525 |
# File 'lib/google/cloud/language/annotation.rb', line 523 def text_span @text_span end |
Instance Method Details
#offset ⇒ Object Also known as: begin_offset
543 544 545 |
# File 'lib/google/cloud/language/annotation.rb', line 543 def offset @text_span.offset end |
#text ⇒ Object Also known as: content
538 539 540 |
# File 'lib/google/cloud/language/annotation.rb', line 538 def text @text_span.text end |