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.



964
965
966
# File 'lib/google/apis/language_v2/classes.rb', line 964

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

Instance Attribute Details

#begin_offsetFixnum

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)


957
958
959
# File 'lib/google/apis/language_v2/classes.rb', line 957

def begin_offset
  @begin_offset
end

#contentString

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

Returns:

  • (String)


962
963
964
# File 'lib/google/apis/language_v2/classes.rb', line 962

def content
  @content
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



969
970
971
972
# File 'lib/google/apis/language_v2/classes.rb', line 969

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