lib/yano/lenient.rb in yano-0.1.2 vs lib/yano/lenient.rb in yano-0.1.3
- old
+ new
@@ -59,21 +59,21 @@
}
def self.get_yes_match_score(val)
y, e, s = val[0], val[1], val[2]
[].tap do |score|
- score << (Y_MATCH.key?(y) ? Y_MATCH[y] : 0)
- score << (E_MATCH.key?(e) ? E_MATCH[e] : 0)
- score << (S_MATCH.key?(s) ? S_MATCH[s] : 0)
+ score << Y_MATCH[y].to_f
+ score << E_MATCH[e].to_f
+ score << S_MATCH[s].to_f
end.reduce(:+)
end
def self.get_no_match_score(val)
n, o = val[0], val[1]
[].tap do |score|
- score << (N_MATCH.key?(n) ? N_MATCH[n] : 0)
- score << (O_MATCH.key?(o) ? O_MATCH[o] : 0)
+ score << N_MATCH[n].to_f
+ score << O_MATCH[o].to_f
end.reduce(:+)
end
def self.check_lenient_values(val)
return true if get_yes_match_score(val) >= YES_MATCH_SCORE_THRESHOLD