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



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

def aspect
  @aspect
end

#caseSymbol (readonly)

The grammatical case.

Returns:

  • (Symbol)

    the current value of case



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

def case
  @case
end

#formSymbol (readonly)

The grammatical form.

Returns:

  • (Symbol)

    the current value of form



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

def form
  @form
end

#genderSymbol (readonly)

The grammatical gender.

Returns:

  • (Symbol)

    the current value of gender



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

def gender
  @gender
end

#moodSymbol (readonly)

The grammatical mood.

Returns:

  • (Symbol)

    the current value of mood



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

def mood
  @mood
end

#numberSymbol (readonly)

The grammatical number.

Returns:

  • (Symbol)

    the current value of number



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

def number
  @number
end

#personSymbol (readonly)

The grammatical person.

Returns:

  • (Symbol)

    the current value of person



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

def person
  @person
end

#properSymbol (readonly)

The grammatical properness.

Returns:

  • (Symbol)

    the current value of proper



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

def proper
  @proper
end

#reciprocitySymbol (readonly)

The grammatical reciprocity.

Returns:

  • (Symbol)

    the current value of reciprocity



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

def reciprocity
  @reciprocity
end

#tagSymbol (readonly)

The part of speech tag.

Returns:

  • (Symbol)

    the current value of tag



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

def tag
  @tag
end

#tenseSymbol (readonly)

The grammatical tense.

Returns:

  • (Symbol)

    the current value of tense



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

def tense
  @tense
end

#voiceSymbol (readonly)

The grammatical voice.

Returns:

  • (Symbol)

    the current value of voice



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

def voice
  @voice
end