10-05-2023, 12:02 PM
(This post was last modified: 10-05-2023, 05:12 PM by Mark Knowles.)
There are alternatives to using the Levenshtein distance, such as the Damerau–Levenshtein distance. However I don't know which would be the most suitable.
The Levenshtein Edit Distance measures the number of edits to get from one text string to another. However this is really a measure of difference not similarity. I think the problem with this is particularly noticeable with long text strings.
I wonder whether a measure where you count similarity instead of difference would be better. So for example high points are scored for identical letters in the same position. Not as high for identical letters shifted by a number of positions(the smaller the shift the higher the points). One could then loop through a string looking for the similarity for each letter in the string to the letters in the other string.
You are not allowed to view links. Register or Login to view.
So there are other string metrics which we could use.
If we compare strings:
"abcde fgh"
with
"abcde ijk"
And then we compare strings:
"fgh"
and
"ijk"
then they appear equally as different/similar when in fact the strings starting "abcde" could be considered to be much more similar given their greater commonality. So here the Levenshtein distance doesn't seem to be giving me what I want.
I wonder if using the sum of the reciprocal is worth considering. Obviously taking a reciprocal turns a big thing into a small thing and vice versus.
I suppose one thing that could be done is manually crudely sorting the words in order of my sense of difference/similarity and then work out what function broadly reflects that way of considering difference.
It seems another alternative is to calculate something like Ratcliff-Obershelp similarity.
The Levenshtein Edit Distance measures the number of edits to get from one text string to another. However this is really a measure of difference not similarity. I think the problem with this is particularly noticeable with long text strings.
I wonder whether a measure where you count similarity instead of difference would be better. So for example high points are scored for identical letters in the same position. Not as high for identical letters shifted by a number of positions(the smaller the shift the higher the points). One could then loop through a string looking for the similarity for each letter in the string to the letters in the other string.
You are not allowed to view links. Register or Login to view.
So there are other string metrics which we could use.
If we compare strings:
"abcde fgh"
with
"abcde ijk"
And then we compare strings:
"fgh"
and
"ijk"
then they appear equally as different/similar when in fact the strings starting "abcde" could be considered to be much more similar given their greater commonality. So here the Levenshtein distance doesn't seem to be giving me what I want.
I wonder if using the sum of the reciprocal is worth considering. Obviously taking a reciprocal turns a big thing into a small thing and vice versus.
I suppose one thing that could be done is manually crudely sorting the words in order of my sense of difference/similarity and then work out what function broadly reflects that way of considering difference.
It seems another alternative is to calculate something like Ratcliff-Obershelp similarity.

