Class: Unbelievable::Haiku

Inherits:
Generator show all
Defined in:
lib/unbelievable/haiku.rb

Constant Summary collapse

TEMPLATES =
[
  [ :single                                                                   ],
  [ :numeral,   :plural                                                       ],
  [ :adjective, :plural                                                       ],
  [ :adjective, :singular                                                     ],
  [ :adjective, :adjective,   :plural                                         ],
  [ :adjective, :adjective,   :singular                                       ],
  [ :numeral,   :adjective,   :plural                                         ],
  [ :singular,  :conjunction, :plural                                         ],
  [ :singular,  :conjunction, :adjective,   :plural                           ],
# [ :numeral,   :adjective,   :adjective,   :plural                           ],
  [ :adjective, :singular,    :conjunction, :adjective, :singular             ],
  [ :adjective, :singular,    :conjunction, :adjective, :adjective, :singular ]
]
QUESTIONS =
[ %w(Are you enjoying), %w(Have you seen), %w(Not enjoying),
%w(Forgot about), %w(Dream about), %w(Remember), %w(Cherish), %w(Recall),
%w(Enjoy), %w(Adore), %w(Like), %w(Love), %w(Miss), %w(See)

Instance Method Summary collapse

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Unbelievable::Generator

Instance Method Details

#story(words) ⇒ Object



27
28
29
30
31
32
# File 'lib/unbelievable/haiku.rb', line 27

def story(words)
  sentences = select_sentences(words)
  each_haiku(sentences) do |haiku|
    reformat(haiku)
  end.join
end