1
2
3
4
5
6
7
8
|
if @seen.has_key?("#cybot_test")
corrections = @seen["#cybot_test"].keys.inject({}) do |hash, name|
distance = edit_distance(nick, name).to_f
hash[name] = distance if distance <= (nick.size + name.size.to_f) / 2.0 * 0.70
hash
end.sort_by { |e| e[1] }
corrected_nick = corrections.first.first
end
|