class DuckPunching
Constants
- VERSION
Public Class Methods
new()
click to toggle source
# File lib/duck_punching.rb, line 6 def initialize Linguistics.use(:en) @lexicon = WordNet::Lexicon.new # use wordnet-defaultdb @num_nouns = WordNet::Synset.nouns.count @num_verbs = WordNet::Synset.verbs.count end
Public Instance Methods
call()
click to toggle source
# File lib/duck_punching.rb, line 25 def call "#{random_noun} #{random_participle}" end
random_noun()
click to toggle source
# File lib/duck_punching.rb, line 14 def random_noun synset = WordNet::Synset.nouns.limit(1, rand(@num_nouns)).first synset.words.sample.lemma end
random_participle()
click to toggle source
# File lib/duck_punching.rb, line 19 def random_participle synset = WordNet::Synset.verbs.limit(1, rand(@num_verbs)).first word = synset.words.sample.lemma word.en.present_participle end