Skip to content

Commit

Permalink
refine adj table
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytonyjan committed Sep 28, 2017
1 parent 51983f6 commit 104c1af
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/jaro_winkler/adjusting_table.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
module JaroWinkler
DEFAULT_ADJ_TABLE = Hash.new
DEFAULT_ADJ_TABLE = Hash.new{|h,k| h[k] = Hash.new(&h.default_proc)}
[
['A', 'E'], ['A', 'I'], ['A', 'O'], ['A', 'U'], ['B', 'V'], ['E', 'I'], ['E', 'O'], ['E', 'U'], ['I', 'O'],
['I', 'U'], ['O', 'U'], ['I', 'Y'], ['E', 'Y'], ['C', 'G'], ['E', 'F'], ['W', 'U'], ['W', 'V'], ['X', 'K'],
['S', 'Z'], ['X', 'S'], ['Q', 'C'], ['U', 'V'], ['M', 'N'], ['L', 'I'], ['Q', 'O'], ['P', 'R'], ['I', 'J'],
['2', 'Z'], ['5', 'S'], ['8', 'B'], ['1', 'I'], ['1', 'L'], ['0', 'O'], ['0', 'Q'], ['C', 'K'], ['G', 'J'],
['E', ' '], ['Y', ' '], ['S', ' ']
].each{ |s1, s2|
if not DEFAULT_ADJ_TABLE.has_key?(s1)
DEFAULT_ADJ_TABLE[s1] = Hash.new
end
if not DEFAULT_ADJ_TABLE.has_key?(s2)
DEFAULT_ADJ_TABLE[s2] = Hash.new
end
].each { |s1, s2|
DEFAULT_ADJ_TABLE[s1][s2] = DEFAULT_ADJ_TABLE[s2][s1] = true
}
DEFAULT_ADJ_TABLE.default = Hash.new
end

0 comments on commit 104c1af

Please sign in to comment.