【发布时间】:2012-01-25 03:11:16
【问题描述】:
我的目标是从两段文本中找到相似的短语。
我知道常用词会有问题。例如,and thewe are the。在这种情况下,我认为过滤器是必要的。
我想知道这是否是一个好方法?这使用递归,如果找到匹配项,它会查看下一个单词是否也是匹配项,并继续直到没有匹配项。
1. the cat is on the roof
2. a man is on the stage
A1 = [the, cat, is, on, the, roof]
A2 = [a, man, is, on, the, stage]
[the]: no match
[cat]: no match
[is]: match
[is, on]: match
[is, on, the]: match
[is, on, the, roof]: no match
[on]: match
[on, the]: match
[on, the, roof]: no match
[the]: match
[the, roof]: no match
[roof]: no match
-end-
【问题讨论】:
-
您希望我们对方法提出建议,您可以显示代码,方法似乎很好
标签: php string recursion logic