lib/ebooks/generator.rb in ebooks-0.1.0 vs lib/ebooks/generator.rb in ebooks-0.2.0
- old
+ new
@@ -12,14 +12,14 @@
end
def generate_twitter_corpus
# Go to Twitter.com -> Settings -> Download Archive.
# This tweets.csv file is in the top directory. Put it in the same directory as this script.
- csv_text = CSV.parse(File.read(@tweets_csv_path))
+ csv_text = CSV.read(@tweets_csv_path)
# Create a new clean file of text that acts as the seed for your Markov chains
File.open(@corpus_path, 'w') do |file|
- csv_text.reverse.each do |row|
+ csv_text.reverse_each do |row|
# Strip links and new lines
tweet_text = row[5].gsub(/(?:f|ht)tps?:\/[^\s]+/, '').gsub(/\n/,' ')
# Save the text
file.write("#{tweet_text}\n")
end