Soundex: Difference between revisions

Content added Content deleted
Line 2,382: Line 2,382:
using Soundex
using Soundex
@assert soundex("Ashcroft") == "A261" # true
@assert soundex("Ashcroft") == "A261" # true

# Otherwise, here is an example not using a package:
# Too trivial? OK. Here is an example not using a package:

function soundex(s)
function soundex(s)
char2num = Dict('B'=>1,'F'=>1,'P'=>1,'V'=>1,'C'=>2,'G'=>2,'J'=>2,'K'=>2,
char2num = Dict('B'=>1,'F'=>1,'P'=>1,'V'=>1,'C'=>2,'G'=>2,'J'=>2,'K'=>2,