Skip to content

Instantly share code, notes, and snippets.

@aphyr
Created January 28, 2013 04:56
Show Gist options
  • Save aphyr/4653165 to your computer and use it in GitHub Desktop.
Save aphyr/4653165 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
@gavinkwoe
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment