Class: Lulz

Inherits:
Object
  • Object
show all
Defined in:
lib/lulz.rb,
lib/lulz/version.rb

Constant Summary collapse

ADJECTIVES =
%W[so such very many much].freeze
VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#process(str) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lulz.rb', line 7

def process(str)
  str = str.downcase
  tagger = EngTagger.new
  tagged_str = tagger.add_tags(str)
  phrases = tagger.get_nouns(tagged_str).keys

  phrases = phrases.each_with_index.map do |noun, i|
    "#{adjective(i)} #{noun}."
  end
  phrases << "wow."
  phrases.join(' ')
end