How to replace sensitive words with regular? Sensitive word filtering? -Segmentfault

Source: Internet
Author: User
Keywords Php mysql Regular expression
Comment Area Sensitive word replacement, if you find sensitive words in the comments before the database, to replace the sensitive words, with regular words how to do? If you want to replace the word "egg", but the article has the word "rotten egg", how to ensure that the eggs are replaced and rotten eggs are not replaced?

Reply content:

Comment Area Sensitive word replacement, if you find sensitive words in the comments before the database, to replace the sensitive words, with regular words how to do? If you want to replace the word "egg", but the article has the word "rotten egg", how to ensure that the eggs are replaced and rotten eggs are not replaced?

    • Asked 4 hours ago
    • Comments
    • Invitation to answer

Please login and comment first

Sort By default sorting time

4 answers

The answer is helpful to the person, has the reference value 1 The answer is no help, it's the wrong answer, irrelevantly replying .

Thank you for inviting me.
If it were me, it would only be checked and then given a hint of the sensitive word, which would not be replaced directly. First of all, I personally do not like this thing, because the replacement is certainly lied, and this kind of examination effect is much smaller than the imagination, the people will avoid the inspection mechanism, and even do not use sensitive words as can express bad speech, so the symptoms do not cure. Second, the normal content becomes difficult to read.
If necessary, you can search this area of the plugin, it should be a very simple class or function to take a thesaurus data, there is no logic to discuss the value. Because you cite the example is not appropriate, if the "egg" is a sensitive word, smelly "egg" is the same as the network monitoring, rather than you imagine the situation, so there is no need to consider the word segmentation problem.

It's better to have a sensitive thesaurus to match the library.

This is unrealistic ...

Then use Polyphone or traditional characters, or pinyin.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.