stephenhaunts / ProfanityDetector

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ContainsProfanity and DetectAllProfanity mismatch

AbhishekTripathi opened this issue · comments

Have a look at the following snippet from linqpad. Why is profanity detected when the ContainsProfanity returns false? Seems to be a bug.

var text = "I am swearing by God's name";
var filter = new ProfanityFilter.ProfanityFilter();
filter.ContainsProfanity(text).Dump(); //returns false
filter.DetectAllProfanities(text, true).Dump() //returns god

Another one for a reverse scenario. Here the ContainsProfanity returns True but DetectAllProfanities returns empty array.

var filter = new ProfanityFilter.ProfanityFilter();
var text = "Have we discussed";
filter.ContainsProfanity(text).Dump(); //returns True
filter.DetectAllProfanities(text).Dump(); // returns empty