require 'csv' def output(title, type) title_length = title.length return nil unless title_length > 3 score = [-36000.0, -400 * (title_length ** 1.5)].max.to_i [title, nil, nil, score, '名詞', '一般', '*', '*', '*', '*', title, '*', '*', type] end CSV.open("user.csv", 'w') do |csv| # niconico Dir::foreach('./niconico') do |f| next unless f =~ /^head[0-9]{4}\.csv$/ open("./niconico/#{f}").each do |line|

