Class: ChatCorrect::Verb

Inherits:
Object
  • Object
show all
Defined in:
lib/chat_correct/verb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(word:, pos:, text:) ⇒ Verb

Returns a new instance of Verb.



4
5
6
7
8
9
10
11
12
# File 'lib/chat_correct/verb.rb', line 4

def initialize(word:, pos:, text:)
  if word.eql?('am') || word.eql?('been') || word.eql?('are') || word.eql?('is') || word.eql?('was') || word.eql?('were')
    @word = 'be'
  else
    @word = word
  end
  @pos = pos
  @text = text
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos.



3
4
5
# File 'lib/chat_correct/verb.rb', line 3

def pos
  @pos
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/chat_correct/verb.rb', line 3

def text
  @text
end

#wordObject (readonly)

Returns the value of attribute word.



3
4
5
# File 'lib/chat_correct/verb.rb', line 3

def word
  @word
end

Instance Method Details

#verb_error?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/chat_correct/verb.rb', line 14

def verb_error?
  !word.eql?('a') && !word.eql?('an') &&
    !word.gsub(/[[:punct:]]/, '').eql?('') && !word.include?('ƪ') &&
    pos.downcase[0].eql?('v') && !word.eql?('to') && check_conjugated_word(word)
end