Class: AiTools::Creativity

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_tools.rb

Class Method Summary collapse

Class Method Details

.generate_poetryObject



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/ai_tools.rb', line 130

def self.generate_poetry
  system("clear")

  require "gabbler"
  require "espeak"

  gabbler = Gabbler.new

  # Read from 3*17 files.
  allistodust           = File.read('poetry/allistodust.txt');           alongforestgreen           = File.read('poetry/alongforestgreen.txt');           anarchojean                  = File.read('poetry/anarchojean.txt')
  atmydoor              = File.read('poetry/atmydoor.txt');              beingmyself                = File.read('poetry/beingmyself.txt');                castleofthesea               = File.read('poetry/castleofthesea.txt')
  coping                = File.read('poetry/coping.txt');                devilgoodcompany           = File.read('poetry/devilgoodcompany.txt');           dianacyberneticdreams        = File.read('poetry/dianacyberneticdreams.txt');
  dontfallback          = File.read('poetry/dontfallback.txt');          droptheidealogies          = File.read('poetry/droptheideologies.txt');          flalaikurose                 = File.read('poetry/flalaikurose.txt');
  girlnothingbutadream  = File.read('poetry/girlnothingbutadream.txt');  goodopticsinthetropics     = File.read('poetry/goodopticsinthetropics.txt');     haywiremeltingdown           = File.read('poetry/haywiremeltingdown.txt');
  inthislandoftennessee = File.read('poetry/inthislandoftennessee.txt'); juicyneonsteak             = File.read('poetry/juicyneonsteak.txt');             lackofcommunication          = File.read('poetry/lackofcommunication.txt');
  laimencoformoonlight  = File.read('poetry/laimencoformoonlight.txt');  leadwithfeelingsnotthemind = File.read('poetry/leadwithfeelingsnotthemind.txt'); lonelypetalswither           = File.read('poetry/lonelypetalswither.txt');
  marrowlust            = File.read('poetry/marrowlust.txt');            mmesmiled                  = File.read('poetry/mmesmiled.txt');                  momentarysilence             = File.read('poetry/momentarysilence.txt');
  neveradrollmoment     = File.read('poetry/neveradrollmoment.txt');     nevermorecrackingknuckles  = File.read('poetry/nevermorecrackingknuckles.txt');  newlaconia                   = File.read('poetry/newlaconia.txt');
  nightlystatues        = File.read('poetry/nightlystatues.txt');        policestate                = File.read('poetry/policestate.txt');                resignationpowder            = File.read('poetry/resigationpowder.txt');
  sentimentality        = File.read('poetry/sentimentality.txt');        shotgungirl                = File.read('poetry/shotgungirl.txt');                skeletonsfinallaugh          = File.read('poetry/skeletonsfinallaugh.txt');
  skyslumbering         = File.read('poetry/skyslumbering.txt');         sliceoflife                = File.read('poetry/sliceoflife.txt');                spidersandtheghost           = File.read('poetry/spidersandtheghost.txt');
  superyacht            = File.read('poetry/superyacht.txt');            thegirlwithrosecheeks      = File.read('poetry/thegirlwithrosecheeks.txt');      theleftarentjellybeans       = File.read('poetry/theleftarentjellybeans.txt');
  thetimeshedied        = File.read('poetry/thetimeshedied.txt');        turntodust                 = File.read('poetry/turntodust.txt');                 undertheweepingwillowtree    = File.read('poetry/undertheweepingwillowtree.txt');
  unraveling            = File.read('poetry/unravelingfriendship.txt');  vivalacyborgia             = File.read('poetry/vivalacyborgia.txt');             waitinginthewall             = File.read('poetry/waitinginthewall.txt');
  whattheysayofrome     = File.read('poetry/whattheysayofrome.txt');     windmillsong               = File.read('poetry/windmillsong.txt');               winonaleeredneckbeyondrepair = File.read('poetry/winonaleeredneckbeyondrepair.txt');
  wiromantic            = File.read('poetry/wiromantic.txt');            yourmerlotourclimate       = File.read('poetry/yourmerlotourclimate.txt');

  # Have Gabbler learn from exponential lines of poetry.
  gabbler.learn(allistodust);           gabbler.learn(alongforestgreen);           gabbler.learn(anarchojean);
  gabbler.learn(atmydoor);              gabbler.learn(beingmyself);                gabbler.learn(castleofthesea);
  gabbler.learn(coping);                gabbler.learn(devilgoodcompany);           gabbler.learn(dianacyberneticdreams);
  gabbler.learn(dontfallback);          gabbler.learn(droptheidealogies);          gabbler.learn(flalaikurose);
  gabbler.learn(girlnothingbutadream);  gabbler.learn(goodopticsinthetropics);     gabbler.learn(haywiremeltingdown);
  gabbler.learn(inthislandoftennessee); gabbler.learn(juicyneonsteak);             gabbler.learn(lackofcommunication);
  gabbler.learn(laimencoformoonlight);  gabbler.learn(leadwithfeelingsnotthemind); gabbler.learn(lonelypetalswither);
  gabbler.learn(marrowlust);            gabbler.learn(mmesmiled);                  gabbler.learn(momentarysilence);
  gabbler.learn(neveradrollmoment);     gabbler.learn(nevermorecrackingknuckles);  gabbler.learn(newlaconia);
  gabbler.learn(nightlystatues);        gabbler.learn(policestate);                gabbler.learn(resignationpowder);
  gabbler.learn(sentimentality);        gabbler.learn(shotgungirl);                gabbler.learn(skeletonsfinallaugh);
  gabbler.learn(skyslumbering);         gabbler.learn(sliceoflife);                gabbler.learn(spidersandtheghost);
  gabbler.learn(superyacht);            gabbler.learn(thegirlwithrosecheeks);      gabbler.learn(theleftarentjellybeans);
  gabbler.learn(thetimeshedied);        gabbler.learn(turntodust);                 gabbler.learn(undertheweepingwillowtree);
  gabbler.learn(unraveling);            gabbler.learn(vivalacyborgia);             gabbler.learn(waitinginthewall);
  gabbler.learn(whattheysayofrome);     gabbler.learn(windmillsong);               gabbler.learn(winonaleeredneckbeyondrepair);
  gabbler.learn(wiromantic);            gabbler.learn(yourmerlotourclimate);
  
  print "What name for your poem? >> "
  poem_name = gets.chomp
  
  open("data/#{poem_name}", "w") { |f|
    12.times do
      f.puts gabbler.sentence
    end
  }
  
  puts "Written to #{poem_name}.txt..."
end