Sha256: c912018843acbdd1bcdf95e3aab734dce784e12b29241871d276da66253f09f3
Contents?: true
Size: 728 Bytes
Versions: 1
Compression:
Stored size: 728 Bytes
Contents
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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dogerific-0.1.0 | lib/dogerific.rb |