mirror of
https://github.com/thewesker/twitter_ebooks.git
synced 2025-12-21 04:41:13 -05:00
Github time!
This commit is contained in:
19
script/process_anc_data.rb
Executable file
19
script/process_anc_data.rb
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
|
||||
require 'json'
|
||||
|
||||
freqmap = {}
|
||||
|
||||
data = File.read("data/ANC-all-count.txt")
|
||||
data = data.unpack("C*").pack("U*")
|
||||
|
||||
data.lines.each do |l|
|
||||
vals = l.split("\t")
|
||||
|
||||
freqmap[vals[0]] = vals[-1].to_i
|
||||
end
|
||||
|
||||
File.open("data/wordfreq.json", 'w') do |f|
|
||||
f.write(JSON.dump(freqmap))
|
||||
end
|
||||
Reference in New Issue
Block a user