Create a gist now

Instantly share code, notes, and snippets.

a small converter for a dataset from http://www.grouplens.org/datasets/movielens/)
f = File.new("u.item_utf8")
ls = f.readlines
puts "["
ls.each do |l|
fs = l.split("|")
/(.*) \((\d+)\)$/.match(fs[1])
title = $1
year = $2
url = fs[4]
puts %Q{{"title": "#{title}", "year": #{year ? year : 0}, "url": "#{url}"}, }
end
puts "]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment