Make the profanity filter not as insanely strict as Warframe's

The profanity filter sucks. Male glitch have a possibility of generating with "Brass" at the start that is never allowed because "ASS"!! and human names Cassie and Cassidy also never pass because of this.
This commit is contained in:
Kae 2023-09-05 17:47:11 +10:00
parent fd915ce672
commit 7c68b8f4af

View File

@ -113,10 +113,13 @@ String PatternedNameGenerator::processRule(JsonArray const& rule, RandomSource&
}
bool PatternedNameGenerator::isProfane(String const& name) const {
auto matchName = name.toLower().rot13();
for (auto naughtyWord : m_profanityFilter) {
if (matchName.contains(naughtyWord))
return true;
auto matchNames = name.toLower().rot13().splitAny(" -");
for (auto& naughtyWord : m_profanityFilter) {
for (auto& matchName : matchNames) {
auto find = matchName.find(naughtyWord);
if (find != NPos && (find == 0 || naughtyWord.size() + 1 >= matchName.size()))
return true;
}
}
return false;
}