From df3f1789c2a439ae2ec4bdc454c8fe9db981630e Mon Sep 17 00:00:00 2001 From: HeavenVR Date: Fri, 13 Sep 2024 15:58:28 +0200 Subject: [PATCH] Update seperation chars, move to containedWords --- DiscordBot/Utils/ProfanityDetector.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DiscordBot/Utils/ProfanityDetector.cs b/DiscordBot/Utils/ProfanityDetector.cs index 110bfd1..a600f7a 100644 --- a/DiscordBot/Utils/ProfanityDetector.cs +++ b/DiscordBot/Utils/ProfanityDetector.cs @@ -19,6 +19,8 @@ public static class ProfanityDetector { "shit", 0.3f }, { "slut", 0.6f }, { "fuck", 0.3f }, + { "wtf", 0.15f }, + { "omfg", 0.15f }, { "i use arch b", 0.9f } }; @@ -31,7 +33,6 @@ public static class ProfanityDetector { "micropython", 0.5f }, { "piss", 0.3f }, { "ass", 0.2f }, - { "wtf", 0.15f }, }; private static float CalculateWeight(float accumulated, float weight) => accumulated == 0 ? weight : MathF.Max(accumulated, weight) + 0.1f; @@ -55,7 +56,7 @@ private static void GetContainedWordsCountAndWeight(ReadOnlySpan lowerCase } private readonly record struct WordRange(int Start, int End); - private static readonly SearchValues _seperationValues = SearchValues.Create([' ', '\t', '\r', '\n', '?', '!', ',', '.', '(', ')']); + private static readonly SearchValues _seperationValues = SearchValues.Create([' ', '\t', '\r', '\n', '?', '!', ',', '.', '(', ')', '"']); private static List GetWordRanges(ReadOnlySpan span) { List wordRanges = [];