Class: Dogeify

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

Constant Summary collapse

ADJECTIVES =
%w(so such very much many).freeze
VERSION =
'1.0.0'

Instance Method Summary collapse

Constructor Details

#initializeDogeify

Returns a new instance of Dogeify.



7
8
9
# File 'lib/dogeify.rb', line 7

def initialize
  @tagger = EngTagger.new
end

Instance Method Details

#process(str) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/dogeify.rb', line 11

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

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