moved minimum word lengths to config

This commit is contained in:
jetsparrow 2019-08-19 21:37:01 +03:00
parent 453bbdf9e4
commit 5db1aefcbb
3 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,8 @@
public struct UnbleeperSettings public struct UnbleeperSettings
{ {
public string BleepedSwearsRegex { get; private set; } public string BleepedSwearsRegex { get; private set; }
public int MinAmbiguousWordLength { get; private set; }
public int MinWordLength { get; private set; }
} }
public struct SearchDictionarySettings public struct SearchDictionarySettings

View File

@ -36,8 +36,8 @@ namespace AntiAntiSwearingBot
!Language.IsTelegramMention(w) !Language.IsTelegramMention(w)
&& Language.HasNonWordChars(w) && Language.HasNonWordChars(w)
&& !Language.IsHashTag(w) && !Language.IsHashTag(w)
&& (Language.HasWordChars(w) || w.Length > 5) && (Language.HasWordChars(w) || w.Length >= Cfg.MinAmbiguousWordLength)
&& w.Length > 2 && w.Length >= Cfg.MinWordLength
&& BleepedSwearsRegex.IsMatch(w) && BleepedSwearsRegex.IsMatch(w)
) )
.ToArray(); .ToArray();

View File

@ -1,6 +1,8 @@
{ {
"Unbleeper": { "Unbleeper": {
"BleepedSwearsRegex": "[а-яА-Я@\\*#]+" "BleepedSwearsRegex": "[а-яА-Я@\\*#]+",
"MinWordLength": 3,
"MinAmbiguousWordLength": 5
}, },
"SearchDictionary": { "SearchDictionary": {
"DictionaryPath": "dict/ObsceneDictionaryRu.txt", "DictionaryPath": "dict/ObsceneDictionaryRu.txt",