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 string BleepedSwearsRegex { get; private set; }
public int MinAmbiguousWordLength { get; private set; }
public int MinWordLength { get; private set; }
}
public struct SearchDictionarySettings

View File

@ -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();

View File

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