require "dogerific/version" require 'engtagger' class Dogerific ADJECTIVES = %w(so such very much many).freeze def initialize @tagger = EngTagger.new end 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 def adjective(i) ADJECTIVES[i % ADJECTIVES.size] end end