Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block atronah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
atronah / mysql.func.getDamerauLevenshtein.sql
Last active Sep 11, 2018
MySQL function for calculating Domerau-Levenshtein distance
View mysql.func.getDamerauLevenshtein.sql
CREATE FUNCTION `getDamerauLevenshtein`(s1 VARCHAR(128) CHARSET utf8, s2 VARCHAR(128) CHARSET utf8) RETURNS int(11)
COMMENT 'Returns Domerau-Levenshtein distance, i.e. minimal number of char operations (cut, paste, replace, transposition) for two string'
DECLARE resultDistance INT(11);
DECLARE currRow INT; -- current row of matrix (0 .. LENGTH(s1))
DECLARE currColumn INT; -- current column of matrix (0 .. LENGTH(s2))
DECLARE s1Length INT; -- first\left\s1 string length
DECLARE s2Length INT; -- second\right\s2 string length
DECLARE replaceDistance INT; -- current distance for replace operation

Keybase proof

I hereby claim:

  • I am atronah on github.
  • I am atronah ( on keybase.
  • I have a public key whose fingerprint is D577 343D 0498 7C9D BD1E 3957 4FBE B649 04E9 F6EE

To claim this, I am signing this object:

You can’t perform that action at this time.