Created
January 28, 2013 04:56
-
-
Save aphyr/4653165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
good