Class: Google::Apis::LanguageV2::TextSpan

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/language_v2/classes.rb,
lib/google/apis/language_v2/representations.rb,
lib/google/apis/language_v2/representations.rb

Overview

Represents a text span in the input document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ TextSpan

Returns a new instance of TextSpan.



661
662
663
# File 'lib/google/apis/language_v2/classes.rb', line 661

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#begin_offset ⇒ Fixnum

The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. Corresponds to the JSON property beginOffset

Returns:

  • (Fixnum)


654
655
656
# File 'lib/google/apis/language_v2/classes.rb', line 654

def begin_offset
  @begin_offset
end

#content ⇒ String

The content of the text span, which is a substring of the document. Corresponds to the JSON property content

Returns:

  • (String)


659
660
661
# File 'lib/google/apis/language_v2/classes.rb', line 659

def content
  @content
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



666
667
668
669
# File 'lib/google/apis/language_v2/classes.rb', line 666

def update!(**args)
  @begin_offset = args[:begin_offset] if args.key?(:begin_offset)
  @content = args[:content] if args.key?(:content)
end