diff --git a/AntiAntiSwearingBot/Config.cs b/AntiAntiSwearingBot/Config.cs index c8f4f03..b8ce4c1 100644 --- a/AntiAntiSwearingBot/Config.cs +++ b/AntiAntiSwearingBot/Config.cs @@ -11,6 +11,8 @@ public struct UnbleeperSettings { public string BleepedSwearsRegex { get; private set; } + public int MinAmbiguousWordLength { get; private set; } + public int MinWordLength { get; private set; } } public struct SearchDictionarySettings diff --git a/AntiAntiSwearingBot/Unbleeper.cs b/AntiAntiSwearingBot/Unbleeper.cs index 239e53e..2ffb392 100644 --- a/AntiAntiSwearingBot/Unbleeper.cs +++ b/AntiAntiSwearingBot/Unbleeper.cs @@ -36,8 +36,8 @@ namespace AntiAntiSwearingBot !Language.IsTelegramMention(w) && Language.HasNonWordChars(w) && !Language.IsHashTag(w) - && (Language.HasWordChars(w) || w.Length > 5) - && w.Length > 2 + && (Language.HasWordChars(w) || w.Length >= Cfg.MinAmbiguousWordLength) + && w.Length >= Cfg.MinWordLength && BleepedSwearsRegex.IsMatch(w) ) .ToArray(); diff --git a/AntiAntiSwearingBot/aasb.cfg.json b/AntiAntiSwearingBot/aasb.cfg.json index d07d182..5060a9b 100644 --- a/AntiAntiSwearingBot/aasb.cfg.json +++ b/AntiAntiSwearingBot/aasb.cfg.json @@ -1,6 +1,8 @@ { "Unbleeper": { - "BleepedSwearsRegex": "[а-яА-Я@\\*#]+" + "BleepedSwearsRegex": "[а-яА-Я@\\*#]+", + "MinWordLength": 3, + "MinAmbiguousWordLength": 5 }, "SearchDictionary": { "DictionaryPath": "dict/ObsceneDictionaryRu.txt",