Sign in

How does laravel judge whether there are some specific keywords in the data

betagamers edited in Sat, 24 Sep 2022

Scenarios and questions:

The messages submitted by users need to be judged whether they are related to pornography or terrorism. They do not need to be blocked and can still be stored in the database. However, I need to traverse the data in the database to judge whether they are related to pornography. For example, how can I traverse 50 pieces of data circularly? Yellow related keywords are specified. (for example, judge whether NIMA, Cao and RI are included in the 50 pieces of data)??


Laravel 5.8 

2 Replies
commented on Sat, 24 Sep 2022

When leaving a message, just judge it directly, and then traverse it again. The content may have been released.

If you have a keyword library, you can use string to search, but the efficiency is relatively low.

In fact, Baidu and Tencent should have free interfaces (there must be certain restrictions) that can be called. When the volume is small, they can be used for free. If the volume is large, it's OK to give some money. Their services will be more reliable.

commented on Sat, 24 Sep 2022

If you want to do it yourself, you need to collect thesaurus. The richness of thesaurus affects your accuracy, and you should also consider the speed of thesaurus processing. If you use a third party, it depends on how many requests are processed. If not, you can use Tencent and Baidu's free natural language processing interface. If more, it depends on the budget