Class: Google::Cloud::Language::Annotation::PartOfSpeech

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/language/annotation.rb

Overview

Provides grammatical information, including morphological information, about a token, such as the token's tense, person, number, gender, and so on. Only some of these attributes will be applicable to any given part of speech. Parts of speech are as defined in [A Universal Part-of-Speech Tagset]http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf

Examples:

require "google/cloud/language"

language = Google::Cloud::Language.new

content = "Darth Vader is the best villain in Star Wars."
document = language.document content
annotation = document.annotate

annotation.tokens.count #=> 10
token = annotation.tokens.first

token.text_span.text #=> "Darth"
token.part_of_speech.tag #=> :NOUN
token.part_of_speech.gender #=> :MASCULINE

Instance Attribute Summary collapse

Instance Attribute Details

#aspectSymbol (readonly)

The grammatical aspect.

Returns:

  • (Symbol)

    the current value of aspect



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def aspect
  @aspect
end

#caseSymbol (readonly)

The grammatical case.

Returns:

  • (Symbol)

    the current value of case



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def case
  @case
end

#formSymbol (readonly)

The grammatical form.

Returns:

  • (Symbol)

    the current value of form



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def form
  @form
end

#genderSymbol (readonly)

The grammatical gender.

Returns:

  • (Symbol)

    the current value of gender



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def gender
  @gender
end

#moodSymbol (readonly)

The grammatical mood.

Returns:

  • (Symbol)

    the current value of mood



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def mood
  @mood
end

#numberSymbol (readonly)

The grammatical number.

Returns:

  • (Symbol)

    the current value of number



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def number
  @number
end

#personSymbol (readonly)

The grammatical person.

Returns:

  • (Symbol)

    the current value of person



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def person
  @person
end

#properSymbol (readonly)

The grammatical properness.

Returns:

  • (Symbol)

    the current value of proper



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def proper
  @proper
end

#reciprocitySymbol (readonly)

The grammatical reciprocity.

Returns:

  • (Symbol)

    the current value of reciprocity



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def reciprocity
  @reciprocity
end

#tagSymbol (readonly)

The part of speech tag.

Returns:

  • (Symbol)

    the current value of tag



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def tag
  @tag
end

#tenseSymbol (readonly)

The grammatical tense.

Returns:

  • (Symbol)

    the current value of tense



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def tense
  @tense
end

#voiceSymbol (readonly)

The grammatical voice.

Returns:

  • (Symbol)

    the current value of voice



315
316
317
# File 'lib/google/cloud/language/annotation.rb', line 315

def voice
  @voice
end