Match two columns with names/strings that are not 100% identical

조회 수: 7 (최근 30일)
Dave
Dave 2022년 10월 13일
댓글: Jan 2022년 10월 14일
Evening, in a table, is there a way to compare two columns with names/strings and find "similar" matches that are not 100% identical?
Instead, they share 80% or more characters to be considered a match. Ignore case and spaces.
For example, the first entry in column1 is NAME123ABC that has 10 characters, and I woud like the index of column 2 if
1- the percentage of shared characters is 80% or more,
2- the percentage of shared characters is 80% or more AND order of characters is identical.
I attached the table with two columns, the same data is pasted below:
'NAME123ABC' 'XYZ'
'NAME2XYZ' 'Name1ABC'
'NAME3333' 'abc'
'NAME ZZZ' '123A'
'' 'AAA'
'' 'ABC ABC'
'' 'Name1 ABCD'
'' 'abcxyname1'
'' 'NAme 1'
'' 'XYZ2'
'' 'ABC NAME1'
'' '123ABC'
For this example, the answer for
1 - with the condition of at least 80% of characters the indices in column2 are: 2, 7, 8 ,11
2 - with the condition of at least 80% of characters AND order of characters the indices in column2 are: 2, 7
danke
  댓글 수: 4
Dave
Dave 2022년 10월 13일
편집: Dave 2022년 10월 13일
  • The AA vs AAAAAAAA case wouldn't be an issue in my data, but I could still another condition such that intersect(A,B) > x
  • The main issue is how to have 'NAME123ABC' when compared to 'BCA Y301 N2' as NOT a match even though they share 8 out of 10 char. This is the case orderFlag = true
Jan
Jan 2022년 10월 14일
@Dave: Again, we do need an exact mathematical definition of what you call "a match", before we can implement it as code. What does "order of characters" mean in case of repeated characters?
This case occurs in your test data: "NAME123ABC" and "Name1 ABCD"
We cannot invent this detail for you, because this is the scientific problem you want to solve.

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2022년 10월 13일
Pool = {'NAME123ABC', 'NAME2XYZ', 'NAME3333', 'NAME ZZZ'}
Data = {'XYZ', 'Name1ABC', 'abc', '123A', 'AAA', 'ABC ABC', 'Name1 ABCD', ...
'abcxyname1', 'NAme 1', 'XYZ2', 'ABC NAME1', '123ABC'};
Data = lower(strrep(Data, ' ', '')); % Remove spaces
Pool = lower(pool);
orderFlag = true;
match = false(size(Data));
for k = 1:numel(Data)
for p = 1:numel(Pool)
if compare(Data{k}, Pool{p}, orderFlag)
match(k) = true;
break;
end
end
end
function m = compare(A, B, flag)
m = (sum(ismember(A, B)) / numel(A) > 0.8);
if m && flag % Order matters:
... Further clarification required
end
end
  댓글 수: 2
Dave
Dave 2022년 10월 13일
편집: Dave 2022년 10월 13일
Thanks a lot Jan
Made minor changes and the orderFlag=false works great, but how can I solve the case orderFlag=true?
For example, I added the first entry in column2 with 'BCA Y301 N2'
Data = {'BCA Y301 N2', 'XYZ', 'Name1ABC', 'abc', '123A', 'AAA', 'ABC ABC', 'Name1 ABCD', ...
'abcxyname1', 'NAme 1', 'XYZ2', 'ABC NAME1', '123ABC'};
And that will ouput a false positive because it shares 8 out 10 char with 'NAME123ABC'.
So, the orderFlag true case should find consecutive char for at least 50% of the entry. So in the case of the
NAME123ABC this is 5 consecutive char:
NAME1
AME12
ME123
...
23ABC
If any of these are found in Data then true.
I tried using extractBetween or intersect but cannot adapt to consecutive char
Jan
Jan 2022년 10월 14일
See my comments to your question. The meaning of "order" must be defined accurately before this can be implemented.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2022년 10월 13일
편집: John D'Errico 2022년 10월 13일
Searching for degree of similarity is not a completely trivial task. In a sense, you want to describe the distance between two "words" or sequences of characters as a number in some way.
One idea might be to consider PAIRS of consecutive characters. For example, suppose we allow any combination of upper case, lower case, numbers, and a space.
Clist = ['A':'Z','a':'z','0:9',' '];
That represents the universe of things we will care about. I suppose I could add in punctation, etc., but that will do for here.
Now, consider all possible combinations of two consecutive elements from that set.
[C1,C2] = meshgrid(Clist);
Clist2 = [C1(:),C2(:)]
Clist2 = 3136×2 char array
'AA' 'AB' 'AC' 'AD' 'AE' 'AF' 'AG' 'AH' 'AI' 'AJ' 'AK' 'AL' 'AM' 'AN' 'AO' 'AP' 'AQ' 'AR' 'AS' 'AT' 'AU' 'AV' 'AW' 'AX' 'AY' 'AZ' 'Aa' 'Ab' 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' ':J' ':K' ':L' ':M' ':N' ':O' ':P' ':Q' ':R' ':S' ':T' ':U' ':V' ':W' ':X' ':Y' ':Z' ':a' ':b' ':c' ':d' ':e' ':f' ':g' ':h' ':i' ':j' ':k' ':l' ':m' ':n' ':o' ':p' ':q' ':r' ':s' ':t' ':u' ':v' ':w' ':x' ':y' ':z' ':0' '::' ':9' ': ' '9A' '9B' '9C' '9D' '9E' '9F' '9G' '9H' '9I' '9J' '9K' '9L' '9M' '9N' '9O' '9P' '9Q' '9R' '9S' '9T' '9U' '9V' '9W' '9X' '9Y' '9Z' '9a' '9b' '9c' '9d' '9e' '9f' '9g' '9h' '9i' '9j' '9k' '9l' '9m' '9n' '9o' '9p' '9q' '9r' '9s' '9t' '9u' '9v' '9w' '9x' '9y' '9z' '90' '9:' '99' '9 ' ' A' ' B' ' C' ' D' ' E' ' F' ' G' ' H' ' I' ' J' ' K' ' L' ' M' ' N' ' O' ' P' ' Q' ' R' ' S' ' T' ' U' ' V' ' W' ' X' ' Y' ' Z' ' a' ' b' ' c' ' d' ' e' ' f' ' g' ' h' ' i' ' j' ' k' ' l' ' m' ' n' ' o' ' p' ' q' ' r' ' s' ' t' ' u' ' v' ' w' ' x' ' y' ' z' ' 0' ' :' ' 9' ' '
So there are 3136 possible 2 character combinations from that set. Now think of the two sequences: 'ABC123' and the sequence '3ABC12'. They have exactly the same set of characters, but in a slightly different sequence, since the 3 is in a different place.
We can use the above set of 2 character sequences to compute the distance between a pair of strings. For example, comare 'ABC123' to 'B1A3C2'. Again, the same numbers and letters, but in a very different sequence here. The previous pair would be seen to have a much smaller distance. I'd suggest a simple scheme. Look at the pairs of consecutive elements of each sequence, and count the num,ber of times a pair is seen in BOTH sequences, so look for overlap of two character sub-sequences. That is, we have these three sequences:
'ABC123' ~ {'AB', 'BC', 'C1', '12', '23'}
'3ABC12' ~ {'3A', 'AB', 'BC', 'C1', '12'}
'B1A3C2' ~ {'B1', '1A', 'A3', '3C', 'C2'}
I've broken them each into 2 digit subsquences. See that 'AB' occurs in BOTH sequences 1 and 2. Similarly, 'BC' also appears in both cases. In fact, 4 of those 5 sequences of 2 characters appear in BOTH sequences 1 and 2. Compare that instead to sequences 1 and 3. There we see NO 2 character subsequences that are the same. So we could define a distance between two sequences in terms of the number of 2 character subsequences they have in common.
You should see this uses the order of characters as an important factor. It would be quite doable, and give you a simple measure of distance. You could add more information into such a measure, but this would gve you a start.

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by