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



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

def aspect
  @aspect
end

#caseSymbol (readonly)

The grammatical case.

Returns:

  • (Symbol)

    the current value of case



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

def case
  @case
end

#formSymbol (readonly)

The grammatical form.

Returns:

  • (Symbol)

    the current value of form



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

def form
  @form
end

#genderSymbol (readonly)

The grammatical gender.

Returns:

  • (Symbol)

    the current value of gender



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

def gender
  @gender
end

#moodSymbol (readonly)

The grammatical mood.

Returns:

  • (Symbol)

    the current value of mood



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

def mood
  @mood
end

#numberSymbol (readonly)

The grammatical number.

Returns:

  • (Symbol)

    the current value of number



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

def number
  @number
end

#personSymbol (readonly)

The grammatical person.

Returns:

  • (Symbol)

    the current value of person



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

def person
  @person
end

#properSymbol (readonly)

The grammatical properness.

Returns:

  • (Symbol)

    the current value of proper



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

def proper
  @proper
end

#reciprocitySymbol (readonly)

The grammatical reciprocity.

Returns:

  • (Symbol)

    the current value of reciprocity



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

def reciprocity
  @reciprocity
end

#tagSymbol (readonly)

The part of speech tag.

Returns:

  • (Symbol)

    the current value of tag



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

def tag
  @tag
end

#tenseSymbol (readonly)

The grammatical tense.

Returns:

  • (Symbol)

    the current value of tense



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

def tense
  @tense
end

#voiceSymbol (readonly)

The grammatical voice.

Returns:

  • (Symbol)

    the current value of voice



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

def voice
  @voice
end