csv import now looks for text column
This commit is contained in:
parent
f80e84189a
commit
2aac54c7aa
3 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
# twitter\_ebooks 2.2.4
|
# twitter\_ebooks 2.2.5
|
||||||
|
|
||||||
Rewrite of my twitter\_ebooks code. While the original was solely a tweeting Markov generator, this framework helps you build any kind of interactive twitterbot which responds to mentions/DMs.
|
Rewrite of my twitter\_ebooks code. While the original was solely a tweeting Markov generator, this framework helps you build any kind of interactive twitterbot which responds to mentions/DMs.
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,10 @@ module Ebooks
|
||||||
end
|
end
|
||||||
elsif path.split('.')[-1] == "csv"
|
elsif path.split('.')[-1] == "csv"
|
||||||
log "Reading CSV corpus from #{path}"
|
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|
|
lines = CSV.read(path).drop(1).map do |tweet|
|
||||||
tweet[5]
|
tweet[text_col]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
log "Reading plaintext corpus from #{path}"
|
log "Reading plaintext corpus from #{path}"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Ebooks
|
module Ebooks
|
||||||
VERSION = "2.2.4"
|
VERSION = "2.2.5"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue