require 'kconv' origin = if $*[0] =~ /wiki/ "wikipedia" elsif $*[0] =~ /hatena/ "hatena" else "unknown" end open($*[0]).each do |title| if origin == "wikipedia" title.strip! elsif origin == "hatena" title = title.toutf8 title = title.split("\t")[1].strip end next if title =~ /^\./ next if title =~ /,/ next if title =~ /[0-9]{4}/ next if title =~ /^[-.0-9]+$/ title_length = title.split(//u).length