stephenhaunts / ProfanityDetector

This is a simple library for detecting profanities within a text string.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding 'scunthorpe' to allow list does not prevent it being considered a profanity

willemaster opened this issue · comments

It looks like the ContainsProfanity() method will consider 'scunthorpe' a profanity even if 'scunthorpe' is on the allow list, because it contains a profanity within itself.

The behaviour we require is to allow such words to be exempted, if they are on the allow list, even if a substring of the word being checked is a profanity.

I can submit a PR for this?

Hi, use IsProfanity instead to get the desired behaviour. IsProfanity will specifically solve the Scunthorpe problem.

ContainsProfanity was added last week as a PR for a specific use-case or another company.

From the documentation:

var filter = new ProfanityFilter();
Assert.IsTrue(filter.IsProfanity("@rsehole"));