Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,38 +1,37 @@
|
|||
code: #[
|
||||
"aeiouy": `W`
|
||||
"bfpv": `1`
|
||||
"cgjkqsxz": `2`
|
||||
"dt": `3`
|
||||
"l": `4`
|
||||
"mn": `5`
|
||||
"r": `6`
|
||||
"aeiouy": 'W'
|
||||
"bfpv": '1'
|
||||
"cgjkqsxz": '2'
|
||||
"dt": '3'
|
||||
"l": '4'
|
||||
"mn": '5'
|
||||
"r": '6'
|
||||
]
|
||||
|
||||
getCode: function [ch][
|
||||
loop keys code 'k [
|
||||
if contains? k lower to :string ch -> return code\[k]
|
||||
]
|
||||
return ` `
|
||||
return ' '
|
||||
]
|
||||
|
||||
soundex: function [str][
|
||||
result: new to :string first str
|
||||
result: to :string first str
|
||||
|
||||
prev: getCode first str
|
||||
loop.with:'i str 'c [
|
||||
curr: getCode c
|
||||
if curr <> ` ` [
|
||||
if and? curr <> `W`
|
||||
if curr <> ' ' [
|
||||
if and? curr <> 'W'
|
||||
curr <> prev -> 'result ++ curr
|
||||
prev: curr
|
||||
]
|
||||
]
|
||||
|
||||
if? 4 < size result ->
|
||||
result: new slice result 0 3
|
||||
else [
|
||||
switch 4 < size result -> result: slice result 0 3
|
||||
[
|
||||
do.times: 4-size result ->
|
||||
'result ++ `0`
|
||||
'result ++ '0'
|
||||
]
|
||||
return result
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue