module ProgrammingIpsum::Inflector::Verb

reference www.oxforddictionaries.com/words/verb-tenses-adding-ed-and-ing

Public Instance Methods

agreement_verb(word) click to toggle source

reference smrtenglish.com/me/lesson/2531

# File lib/programming_ipsum/inflector.rb, line 71
def agreement_verb(word)
  if word =~ /(ss|sh|ch|x|o|z)$/
    word + 'es'
  elsif word =~ /[^aeiou]y$/
    word[0..-2] + 'ies'
  else
    word + 's'
  end
end
gerund_verb(word) click to toggle source

no way to check syllables in ruby, so this has some issues.

# File lib/programming_ipsum/inflector.rb, line 42
def gerund_verb(word)
  if word =~ /[^oey]e$/
    word[0..-2] + 'ing'
  elsif word[-1] == 'c'
    word + 'king'
  elsif word =~ /[^aeiou][aeiou][^aeiouxw]$/
    word + word[-1] + 'ing'
  else
    word + 'ing'
  end
end
past_verb(word) click to toggle source
# File lib/programming_ipsum/inflector.rb, line 54
def past_verb(word)
  if word[-1] == 'e'
    word + 'd'
  elsif word[-1] == 'c'
    word + 'ked'
  elsif word =~ /[aeiou][aeiou][^aeiou]$/
    word + 'ed'
  elsif word =~ /[aeiou]([^aeiou])$/
    word + $1 + "ed"
  elsif word =~ /[aeiou]l$/
    word + 'led'
  else
    word + 'ed'
  end
end