Class: Google::Apis::LanguageV1::Token

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

Overview

Represents the smallest syntactic building block of the text.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Token

Returns a new instance of Token.



1248
1249
1250
# File 'lib/google/apis/language_v1/classes.rb', line 1248

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

Instance Attribute Details

#dependency_edgeGoogle::Apis::LanguageV1::DependencyEdge

Represents dependency parse tree information for a token. (For more information on dependency labels, see http://www.aclweb.org/anthology/P13-2017 Corresponds to the JSON property dependencyEdge



1230
1231
1232
# File 'lib/google/apis/language_v1/classes.rb', line 1230

def dependency_edge
  @dependency_edge
end

#lemmaString

Lemma of the token. Corresponds to the JSON property lemma

Returns:

  • (String)


1235
1236
1237
# File 'lib/google/apis/language_v1/classes.rb', line 1235

def lemma
  @lemma
end

#part_of_speechGoogle::Apis::LanguageV1::PartOfSpeech

Represents part of speech information for a token. Parts of speech are as defined in http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf Corresponds to the JSON property partOfSpeech



1241
1242
1243
# File 'lib/google/apis/language_v1/classes.rb', line 1241

def part_of_speech
  @part_of_speech
end

#textGoogle::Apis::LanguageV1::TextSpan

Represents a text span in the input document. Corresponds to the JSON property text



1246
1247
1248
# File 'lib/google/apis/language_v1/classes.rb', line 1246

def text
  @text
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1253
1254
1255
1256
1257
1258
# File 'lib/google/apis/language_v1/classes.rb', line 1253

def update!(**args)
  @dependency_edge = args[:dependency_edge] if args.key?(:dependency_edge)
  @lemma = args[:lemma] if args.key?(:lemma)
  @part_of_speech = args[:part_of_speech] if args.key?(:part_of_speech)
  @text = args[:text] if args.key?(:text)
end