class Dogerific

Constants

ADJECTIVES
VERSION

Public Class Methods

new() click to toggle source
# File lib/dogerific.rb, line 7
def initialize
  @tagger = EngTagger.new
end

Public Instance Methods

convert(arg, options = {}) click to toggle source
# File lib/dogerific.rb, line 11
def convert(arg, options = {})
  arg = arg.downcase

  #This is from engtagger...tag a string, get its
  #nouns, and prefix with doge adjectives
  tagged_str = @tagger.add_tags(arg)
  phrases = @tagger.get_nouns(tagged_str).keys
  phrases = phrases.each_with_index.map do |phrase, i|
    "#{adjective(i)} #{phrase}."
  end

  #Each phrase is doge, and thus ends in "wow"
  phrases << 'wow.'

  #Separate each sentence with a space.
  phrases.join(' ')
end

Private Instance Methods

adjective(i) click to toggle source
# File lib/dogerific.rb, line 31
def adjective(i)
  ADJECTIVES[i % ADJECTIVES.size]
end