The Year in Bookmarks
| emacs, ruby| Top 10 tags for 2005 | productivity(104) web2.0(88) digitalpinay(88) social(84) useful(83) business(80) blogs(70) research(69) lifehacks(68) blogging(60) |
Check out my year in bookmarks for more detail. =) If you want me to analyze yours, just save http://del.icio.us/api/posts/all to all.xml and run this Ruby script. You can also e-mail me (sacha@plannerlove.com) your all.xml if you don't want to go through the hassle yourself.
Much fun!
#!/usr/bin/ruby
require 'rexml/document'
require 'date'
include REXML
YEAR = 2005
USER = "sachac"
doc = Document::new(File::new('all.xml'))
month_hash = {}
month_total = {}
tag_total = {}
doc.elements[1].elements.each {
|x|
date = DateTime::parse(x.attributes['time'])
if (date.year == YEAR)
x.attributes['tag'].split(' ').each {
|tag|
month_hash[date.month] ||= {}
month_hash[date.month][tag] ||= 0
month_hash[date.month][tag] += 1
tag_total[tag] ||= 0
tag_total[tag] += 1
}
month_total[date.month] ||= 0
month_total[date.month] += 1
end
}
s = "Top 10 tags for " + YEAR.to_s + " |"
tag_total.sort_by { |tag,total| -total }.slice(0, 10).each { |tag,total|
s += ' " + tag + "(" + total.to_s + ")"
}
puts s
month_hash.sort.each { |month,tags|
s = Date::MONTHNAMES[month] + "
(" + month_total[month].to_s + " bookmarks) |"
tags.sort_by { |tag,total| -total }.each {
|tag,total|
s += ' " + tag + "(" + total.to_s + ")"
}
puts s
}
You can e-mail me at sacha@sachachua.com.