I'm trying to develop a python algorithm to check if a string could be an abbrevation for another word. For example
fck
is a match forfc kopenhavn
because it matches the first characters of the word.fhk
would not match.fco
should not matchfc kopenhavn
because no one irl would abbrevate FC Kopenhavn as FCO.irl
is a match forin real life
.ifk
is a match forifk goteborg
.aik
is a match forallmanna idrottskluben
.aid
is a match forallmanna idrottsklubben
. This is not a real team name abbrevation, but I guess it is hard to exclude it unless you apply domain specific knowledge on how Swedish abbrevations are formed.manu
is a match formanchester united
.
It is hard to describe the exact rules of the algorithm, but I hope my examples show what I'm after.
Update I made a mistake in showing the strings with the matching letters uppercased. In the real scenario, all letters are lowercase so it is not as easy as just checking which letters are uppercased.
aik
is valid, butaid
is not valid? – Zulmazulu