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 = "Star Wars is a great movie. The Death Star is fearsome."
document = language.document content
annotation = document.annotate

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

token.text_span.text #=> "Star"
token.part_of_speech.tag #=> :NOUN
token.part_of_speech.number #=> :SINGULAR

Instance Attribute Summary collapse

Instance Attribute Details

#aspectSymbol (readonly)

The grammatical aspect.

Returns:

  • (Symbol)

    the current value of aspect



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def aspect
  @aspect
end

#caseSymbol (readonly)

The grammatical case.

Returns:

  • (Symbol)

    the current value of case



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def case
  @case
end

#formSymbol (readonly)

The grammatical form.

Returns:

  • (Symbol)

    the current value of form



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def form
  @form
end

#genderSymbol (readonly)

The grammatical gender.

Returns:

  • (Symbol)

    the current value of gender



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def gender
  @gender
end

#moodSymbol (readonly)

The grammatical mood.

Returns:

  • (Symbol)

    the current value of mood



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def mood
  @mood
end

#numberSymbol (readonly)

The grammatical number.

Returns:

  • (Symbol)

    the current value of number



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def number
  @number
end

#personSymbol (readonly)

The grammatical person.

Returns:

  • (Symbol)

    the current value of person



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def person
  @person
end

#properSymbol (readonly)

The grammatical properness.

Returns:

  • (Symbol)

    the current value of proper



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def proper
  @proper
end

#reciprocitySymbol (readonly)

The grammatical reciprocity.

Returns:

  • (Symbol)

    the current value of reciprocity



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def reciprocity
  @reciprocity
end

#tagSymbol (readonly)

The part of speech tag.

Returns:

  • (Symbol)

    the current value of tag



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def tag
  @tag
end

#tenseSymbol (readonly)

The grammatical tense.

Returns:

  • (Symbol)

    the current value of tense



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def tense
  @tense
end

#voiceSymbol (readonly)

The grammatical voice.

Returns:

  • (Symbol)

    the current value of voice



325
326
327
# File 'lib/google/cloud/language/annotation.rb', line 325

def voice
  @voice
end