meta name="author" content="Haiku eBooks" />
Haiku Chapbooks Volume 1:
Haikus are easy
Five then seven then five more
George Bush is racist
THE SPECTACULAR
NOW OR THE SPECTACULAR
WAYS TO MURDER ME
By @ddlwoodley
Woof Woof Woof Woof Woof
Woof Woof Woof Woof Woof Woof Woof
Woof Woof Woof Woof Woof
By @AstronautPuppy
coffee and rick ross
seem to be the solution
for my tiredness
By @Rafa_Villareal
Silicon Valley
needs to lose the arrogance
or risk destruction
By @whirrtom
half of these people
don't know what really happen
but it's all gucci
By @BeauDEE_42
The only reason
I get up in the mornings
is to get coffee
By @LordBartholomeu
the worst desire
apart from the desire
to not desire
by @kisstina__
i still cant believe
i have this phone its insane
i love it so much
by @denahappy
and adorable
and charming and beautiful
and wonderful and
by @syafikamarino__
Breathe Breathe Breathe Breathe Breathe
Breathe Breathe Breathe Breathe Breathe Breathe Breathe
Breathe Breathe Breathe Breathe Breathe
by @Radicalexy
thanks but it turns out
she was just trying to frame
me for a murder
by @darrenstop
Task Force recommends
changes to first responders
benefit structure
by @k5hedz
i want to get paid
to do something cool like skate
or photography
by @CaptTurkeyBacon
all they do is walk
around and set everything
equal to zero
by @itsyungindy
my cat is snoring
can he get anymore cute
the answer is no
by @teademon
trying to look smart
but not too smart to threaten
everything they say
by @uhnehsa
Yo yo yo yo yo
im trying to make a rap
but I guess life sucks
by @horanfaggg
IS ANYONE HERE
LIVING IN AMERICA
I HAVE A QUESTION
by @Bangin_clifford
I rather respect
you just give me the respect
I'm supposed to get
by @Skiparotchi
ion even fuck
wit all the folks i fucked wit
in the beginning
by @Yess_ItsTAY
If its cold in here
I can only imagine
how it feels outside
by @DiamanteColon
I won't to go Home
get under my warm cover
and sleep forever
by @YUNG_CHEERUP
wow ok SICK GUY
never doing that again
I can assure you
by @dracarys___
of information
deteriorates upward
through bureaucracies
by @pyelicvfaVirajv
haven't had a good
day today i haven't had
a good day today
by @forgechurchtomm
I have no talents
and I'm not pretty ok
see you tomorrow
by @paradisegrrrl
I want a starbucks
with extra extra extra
extra caramel
by @_celestteee
Go away shoo man
I don't need you to become
a situation
by @saaaje
I regret selling
all my babies but oh well
money is money
by @Yo_Edlex
I need to get drunk
soon I need to let myself
get white girl wasted
by @_abieevans
the cats are sitting
side by side at the window
watching the snow fall
by @Meow_or_Never
You don't know me though
I be that person smoking
weed by the kilos
by @Geerockss_
Basic girls calling
basic girls basic that call
basic girls basic
by @deadboytonyy
This is not real life
who throws a pan through a door
I don't understand
by @kimbaly_ann
everything is fine
when you're standing in the eye
of the hurricane
by @dinamorales91
my dream was perfect
everything was going great
until I woke up
by @grandeseIs
they on an island
cracking open coconuts
and catching crawfish
by @marandabell
im so excited
to go home and see my cat
i miss her so much
by @devastatedziall
I feel like young thug
should be on sesame street
or do a gap ad
by @q8rtuv
the invisible
greeting cards you always send
me oh how thoughtful
by @FifteenMoons
THE NOISES I MADE
OPENING EACH ENVELOPE
YOU DON'T UNDERSTAND
by @pandabouzu
We make decisions
based on our truth or the lies
we tell ourselves
by @scookcrishelle
sick of being sick
tired of being tired
bored of being bored
by @BayleeJustine
as long as you love
love love love love love love love
love love love love me
by @SARMANDALEE
I'm serious guys
I fucking worship nature
that shit is the bomb
by @MattTaibi
This is beginning
to become more frustrating
than entertaining
by @hannahkonnie
home alone all day
tomorrow surprise surprise
someone come over
by @GRae_Esqueda
Couple years ago
I was in a dark place now
I'm starting to live
by @NofeelinzzzZ
If one more person
threatens to deactivate
I mIGHT JUST LOSE IT
by @rnagcon
Performance issues
on all services being
investigated
by @PurleyHosting
# haiku_ebooks/Gemfile
source "https://rubygems.org"
gem "twitter", "~> 4.8.1"
gem "tweetstream", "~>2.5.0"
# haiku_ebooks/Procfile
haiku: ruby lib/Haiku.rb
# haiku_ebooks/lib/syllable_dictionary.rb
# syllable_dictionary.txt is based on the CMU pronuniciation dictionary and looks like this:
# CAT, 1
# CATHY, 2
# etc. (Sorry about that, but we can't show files that are this big right now.)
dict_path = File.expand_path("../syllable_dictionary.txt", __FILE__)
dict = File.readlines(dict_path, "r").join.split("\n")
SYLLABLE_DICTIONARY = Hash.new
dict.each do |entry|
word, syllables = entry.strip.split(",")
SYLLABLE_DICTIONARY[word] = syllables.to_i
end
# haiku_ebooks/lib/web_scraper.rb
require "twitter"
require "tweetstream"
Twitter.configure do |config|
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
config.oauth_token = ENV['TWITTER_OAUTH_TOKEN']
config.oauth_token_secret = ENV['TWITTER_OAUTH_SECRET']
end
TweetStream.configure do |config|
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
config.oauth_token = ENV['TWITTER_OAUTH_TOKEN']
config.oauth_token_secret = ENV['TWITTER_OAUTH_SECRET']
config.auth_method = :oauth
end
# haiku_ebooks/lib/string.rb
require_relative 'syllable_dictionary.rb'
class String
BAD_WORDS = %w(a about ain't aint all an and anything are as at be because
been but can't do don't dont even feel feels for from gave get getting go
goes going gonna gonna gotta has have he her his how i i'll i'm if im in
is isn't isnt it it's its just keep lets like looks make makes me might
must my no not of on or please really say see she should so some stay such
take tell that that's thats the their then there there's theres to u up
used want wants were what whats when where who whole will with won't wont
would yea yeah you)
def syllable_count
self.split(" ").inject(0) do |sum, word|
sum + SYLLABLE_DICTIONARY[word.upcase]
end
rescue TypeError
return nil
end
def haiku?
return false if self.syllable_count != 17
words = self.split(" ")
false_or_words = count_to(5, words)
false_or_words = count_to(7, false_or_words) if false_or_words
!!false_or_words
end
def count_to(num, words)
count = 0
until count == num
last = words.shift
count += last.syllable_count
return false if count > num
end
return false if BAD_WORDS.include?(last.downcase)
words
end
def haikuify
words = self.split(" ")
haiku = []
count = 0
until count == 5
word = words.shift
count += word.syllable_count
haiku << word
end
haiku << "/"
until count == 12
word = words.shift
count += word.syllable_count
haiku << word
end
haiku << "/"
haiku << words
haiku.join(" ")
end
end
# haiku_ebooks/lib/Haiku.rb
require_relative 'string.rb'
require_relative 'syllable_dictionary.rb'
require_relative 'web_scraper.rb'
class HaikuFinder
def self.run_bot
begin
TweetStream::Client.new.sample(language: 'en') do |tweet|
return tweet if tweet.text.haiku?
end
rescue
sleep 300
retry
end
end
def self.post_tweet(tweet)
puts "got one!"
Twitter.retweet(tweet.id)
end
end
loop do
puts "starting search"
HaikuFinder.post_tweet(HaikuFinder.run_bot)
sleep 1200
end
# haiku_ebooks/spec/string_spec.rb
require_relative '../lib/string.rb'
describe String do
describe ".syllable_count" do
it "should know it's count" do
"alpha".syllable_count.should == 2
end
it "should know the count of multiple words" do
"alpha tango bravo nine".syllable_count.should == 7
end
it "should handle weird white space" do
" white space ".syllable_count.should == 2
end
# maybe I should add poopies to the dictionary?
# it's kind of absurd that a twitter bot doesn't know about poop jokes
it "should deal with words that it doesn't know" do
"poopies".syllable_count.should == nil
end
end
describe ".haiku?" do
it "should know that 17 is the number" do
"one two three".haiku?.should == false
end
it "should know if a string is a haiku" do
haiku = "this is a haiku written in order to test that i know haiku"
haiku.haiku?.should == true
end
it "should know that a string is not a haiku" do
not_haiku = "i am not a haiku though i am made of seven teen syllables"
not_haiku.haiku?.should == false
end
end
end
Haiku eBooks / Cole Willsea 2014
Open Source No Copyright Do Whatever License