Class: Google::Cloud::Language::Annotation::TextSpan
- Inherits:
-
Object
- Object
- Google::Cloud::Language::Annotation::TextSpan
- Defined in:
- lib/google/cloud/language/annotation.rb
Overview
Represents a piece of text including relative location.
Instance Attribute Summary collapse
-
#offset ⇒ Integer
(also: #begin_offset)
readonly
The API calculates the beginning offset of the content in the original document according to the ‘encoding` specified in the API request.
-
#text ⇒ String
(also: #content)
readonly
The content of the output text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text, offset) ⇒ TextSpan
constructor
A new instance of TextSpan.
Constructor Details
#initialize(text, offset) ⇒ TextSpan
Returns a new instance of TextSpan.
237 238 239 240 |
# File 'lib/google/cloud/language/annotation.rb', line 237 def initialize text, offset @text = text @offset = offset end |
Instance Attribute Details
#offset ⇒ Integer (readonly) Also known as: begin_offset
The API calculates the beginning offset of the content in the original document according to the ‘encoding` specified in the API request.
230 231 232 |
# File 'lib/google/cloud/language/annotation.rb', line 230 def offset @offset end |
#text ⇒ String (readonly) Also known as: content
The content of the output text.
230 231 232 |
# File 'lib/google/cloud/language/annotation.rb', line 230 def text @text end |
Class Method Details
.from_grpc(grpc) ⇒ Object
244 245 246 |
# File 'lib/google/cloud/language/annotation.rb', line 244 def self.from_grpc grpc new grpc.content, grpc.begin_offset end |