Skip to content

Instantly share code, notes, and snippets.

@statik
Forked from aphyr/gist:4653165
Created January 28, 2013 20:21
Show Gist options
  • Save statik/4658665 to your computer and use it in GitHub Desktop.
Save statik/4658665 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'twitter'
require 'marky_markov'
def tweets
block = Twitter.user_timeline("joedamato", count: 200)
text = block.map(&:text)
max = block.last.id
until block.empty?
block = Twitter.user_timeline("joedamato", count: 200, max_id: max - 1)
text += block.map(&:text)
max = block.last.id rescue nil
p max
end
text
end
puts tweets.map { |t| t.sub /\.$/, '' }.join(".\n");
#!/usr/bin/ruby
require 'marky_markov'
m = MarkyMarkov::TemporaryDictionary.new
m.parse_file('corpus.txt')
corpus = File.read('corpus.txt')
128.times do
candidate = m.generate_n_sentences(1)
unless corpus.include? candidate
puts candidate
puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment