开发者

Soundex and checking for invalid sound

开发者 https://www.devze.com 2023-01-28 04:33 出处:网络
Is it ok to check for SQL returning 开发者_Go百科a Soundex of 0000 based on the assumption that it isn\'t a valid word, e.g. has digits, spaces, special characters or is there a better way to do this?

Is it ok to check for SQL returning 开发者_Go百科a Soundex of 0000 based on the assumption that it isn't a valid word, e.g. has digits, spaces, special characters or is there a better way to do this?


I don't think soundex is good for that, I think the SOUNDEX() function will omit the digits, spaces and symbol, for example:

SELECT SOUNDEX("HELLO")
SELECT SOUNDEX("_HEL123O_")

Both give you the same result.

H400

Besides SOUNDEX() has some limitation in the way it works.

You can take a look at the Levenshtein distance, it determines the number of operations you have to do to make one string exactly like another. You can find an implementation here.

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消