php - What algorithm can I use to solve this case(string matching/word matching)?


I wanna build web forum for my mini thesis project. The system will work like this "question/discussion will be matched with keyword that exist in tb_keyword, if it's found 2 matched words or more, question/discussion will be sent into tb_post". I've tried to solve this problem with brute force algorithm but it's not working. I convert data from input to array and as well as keyword in tb_keyword. What algorithm can I use to solve this problem?

Example :

input : metode or algorithm can solve this problem?


| id |   keyword   |

How to make all of them can be compared like this:


In that example metode and algorithm exist in tb_keyword so it will be sent into tb_post.



| 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

People are also looking for solutions to the problem: php - Storing multiple items into a session


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.