Module: Lolcat

Defined in:
lib/lulzcatz.rb

Constant Summary collapse

REPL =
{ 
    /what/     => %w/wut whut/,   /you\b/   => %w/yu yous yoo u/,
    /cture/    => ['kshur'],          /unless/    => ['unles'],
    /the\b/=> ['teh'],            /more/      => ['moar'],
    /my/       => %w/muh mah/,    /are/       => %w/r is ar/,
    /eese/     => ['eez'],            /ph/        => ['f'],
    /as\b/   => ['az'],             /seriously/ => ['srsly'],
    /er\b/   => ['r'],              /sion/      => ['shun'],
    /just/     => ['jus'],            /ose\b/   => ['oze'],
    /eady/     => ['eddy'],           /ome?\b/  => ['um'],
    /of\b/   => %w/of ov of/,   /uestion/ => ['wesjun'],
    /want/     => %w/wants/,          /ead\b/   => ['edd'],
    /ucke/     => %w/ukki ukke/,  /sion/      => ['shun'],
    /eak/      => %w/ekk/,            /age/       => ['uj'],
    /like/     => %w/likes liek/, /love/      => %w/loves lub lubs luv/,
    /\bis\b/ => %w/ar teh ar/,  /nd\b/   => ['n'],
    /who/      => %w/hoo/,            /\'/      => [''],
    /ese\b/  => %w/eez/,            /outh/      => %w/owf/,
    /scio/     => ['shu'],            /esque/     => %w/esk/,
    /ture/     => ['chur'],           /\btoo?\b/=> %w/to t 2 to t/,
    /tious/    => ['shus'],           /sure\b/  => ['shur'],
    /tty\b/  => ['tteh'],           /were/      => ['was'],
    /ok\b/   => %w/'k kay/ ,   /\ba\b/   => [''],
    /ym/       => ['im'],             /thy\b/   => ['fee'],
    /\wly\w/ => ['li'],             /que\w/   => ['kwe'],
    /oth/      => ['udd'],            /ease/      => ['eez'],
    /ing\b/  => %w/in ins ng ing/,
    /have/   => %w/has hav haz a/,
    /your/     => %w/yur ur yore yoar/,
    /ove\b/  =>  %w/oov ove uuv uv oove/,
    /for/      => %w/for 4 fr fur for foar/,
    /thank/    => %w/fank tank thx thnx/,
    /good/     => %w/gud goed guud gude gewd/,
    /really/   => %w/rly rily rilly rilley/,
    /world/    => %w/wurrld whirld wurld wrld/,
    /i'?m\b/     => ['im'],
    /(?!e)ight/   => ['ite'],
    /(?!ues)tion/ => ['shun'],
    /you\'?re/    => %w/yore yr/,
    /\boh\b(?!.*hai)/  => %w/o ohs/,
    /can\si\s(?:ple(?:a|e)(?:s|z)e?)?\s?have\sa/ => ['i can has'],
    /(?:hello|\bhi\b|\bhey\b|howdy|\byo\b),?/    => ['oh hai,'],
    /(?:god|allah|buddah?|diety)/                => ['ceiling cat'],
}

Class Method Summary collapse

Class Method Details

.translate(sentence) ⇒ Object



47
48
49
# File 'lib/lulzcatz.rb', line 47

def self.translate(sentence)
    self.translate! sentence.dup
end

.translate!(sentence) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/lulzcatz.rb', line 51

def self.translate!(sentence)
    sentence.downcase!
    REPL.keys.each do |key|
        while key =~ sentence
            sentence.sub!(key, REPL[key].sample)
        end
    end
    return sentence.upcase!
end