On Thursday, 10 May 2018 at 20:38:12 UTC, Vladimir Panteleev
wrote:
On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote:
immutable size_t len = s1.length + s2.length;
percent = (len - distance) * 100.0 / len;
Note that this formula will give you only 50% similarity for
"abc" and "def", i.e. two completely different strings. I
suggest to divide by max(s1.length, s2.length) instead.
Hm, that does not work either. ABC and AZB have a different
outcome with both. How can I calculate the percentage with
levenshtein? It's rather simple with similar_text since it
returns the amount of similar chars.