比较文本字符串以查看它们是否匹配(允许轻微差异)

4 php string comparison

我正在尝试比较两个来源的数据.

ORIG Kick-Ass: Music From The Motion Picture
ALT Kick-A*s (Music from the Motion Picture)
ALT Kick-Ass: (Music from the Motion Picture)[Explicit]
ALT Kick-Ass: A dedication
Run Code Online (Sandbox Code Playgroud)

ALT 1 ALT 2和ORIG是相同的匹配.ALT 3是虚拟结果.

我需要验证这些是否匹配,PHP库中是否有可用的方法.我想用count_chars计算每个单独的字符,然后使用百分比匹配比较ORIG字符串.然而,如果它的标题很短,它将无法正常工作.

你有什么想法我可以验证它们匹配,

干杯,

Ĵ

Pet*_*ley 5

好吧,总是有levenshtein距离,但我不确定最终对你有用.

可能是值得一试,虽然.