Posted by shaklevgmailcom on Mon 6th Apr 06:10 (modification of post by view diff)
download | new post
- a= File.read("/users/Houshuang/Downloads/doaj.csv")
- c = 0
- lang = {}
- a.each do |line|
- c=c+1
- t = line.split('","')
- langs = t[2].split(',')
- langs.each do |l|
- l.strip!
- lang[l] = (lang[l] ? lang[l] + 1 : 1)
- end
- break if c == 20000000
- end
- puts "<table>"
- lang.sort {|a,b| b[1]<=>a[1]}.each do |key|
- puts "<tr><td>" + key[0] + "</td><td>" + key[1].to_s + "</td></tr>"
- end
- puts "</table>In total: #{c}, number of categories: #{lang.size}"
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.