The distance here is a modified version of Levenshtein distance. It is the same as Levenshtein distance except replacement steps that add or remove a diacritic cost only 1/2 of a step as opposed to their normal 12. This is because if you guessed á
instead of a
that's not as bad as if you guessed f
instead of a
.