lib/twitter_ebooks/model.rb in twitter_ebooks-2.2.4 vs lib/twitter_ebooks/model.rb in twitter_ebooks-2.2.5
- old
+ new
@@ -27,11 +27,13 @@
lines = JSON.parse(content, symbolize_names: true).map do |tweet|
tweet[:text]
end
elsif path.split('.')[-1] == "csv"
log "Reading CSV corpus from #{path}"
+ header = CSV.read(path).first
+ text_col = header.index('text')
lines = CSV.read(path).drop(1).map do |tweet|
- tweet[5]
+ tweet[text_col]
end
else
log "Reading plaintext corpus from #{path}"
lines = content.split("\n")
end