class Tracinho::Word

Word is the class that represents a word (duh!). It includes some methods to quickly get the complement word or the classification.

Example:

word = Tracinho::Word.new('comeste')

word.hyphenated?
# => false

word.complement
# => "comes-te"

word.grammar_class
# => "Segunda pessoa do singular do pretérito perfeito do indicativo do verbo comer."

Public Class Methods

new(text) click to toggle source
# File lib/tracinho/word.rb, line 20
def initialize(text)
  @text = text
end

Public Instance Methods

complement() click to toggle source

Returns the complement of the word.

# File lib/tracinho/word.rb, line 30
def complement
  ComplementBuilder.new(self).build
end
grammar_class() click to toggle source
# File lib/tracinho/word.rb, line 34
def grammar_class
  WordClassifier.new(self).full_classification
end
hyphenated?() click to toggle source

Returns true if the word as a hyphen (the '-' character) or false otherwise.

# File lib/tracinho/word.rb, line 25
def hyphenated?
  @text.include?('-')
end
to_s() click to toggle source
# File lib/tracinho/word.rb, line 38
def to_s
  @text
end