我想为我的迷你论文项目建立网络论坛。系统将像这样工作 "问题/讨论将与tb_keyword中存在的关键字匹配,如果找到2个匹配的单词或更多, 问题/讨论将发送到tb_post"。我试图用强力算法解决这个问题,但它没有用。我将数据从输入转换为数组,以及tb_keyword中的关键字。 我可以使用什么算法来解决这个问题?
示例:
输入:metode或算法可以解决这个问题吗?
tb_keyword
| id | keyword |
--------------------
| 1. | method |
| 2. | algorithm |
| 3. | experiment |
如何使所有这些都可以这样比较:
method[0]=> method[1] = matched => 1 matched
or[1] =>method[1] = didn't match
or[1]=>algorithm[2]=didin't match
or[1]=>experiment[3]=didin't match
algorithm[2]=> method[1] =didin't match
algorithm[2]=> algorithm[2] =matched => 1 matched
can[3] =>method[1] = didn't match
can[3]=>algorithm[2]=didin't match
can[3]=>experiment[3]=didin't match
solve[4] =>method[1] = didn't match
solve[4]=>algorithm[2]=didin't match
solve[4]=>experiment[3]=didin't match
this[5] =>method[1] = didn't match
this[5]=>algorithm[2]=didin't match
this[5]=>experiment[3]=didin't match
problem[6] =>method[1] = didn't match
problem[6]=>algorithm[2]=didin't match
problem[6]=>experiment[3]=didin't match
count(matched) = 2
在该示例中,teode和算法存在于tb_keyword中,因此它将被发送到tb_post。