commit fea5bdc: [Conf] Add language detection configuration

Vsevolod Stakhov vsevolod at rspamd.com
Sat Apr 29 17:14:06 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-04-29 14:53:40 +0100
URL: https://github.com/rspamd/rspamd/commit/fea5bdc79758530a3c28970c9c19d05e9932de74

[Conf] Add language detection configuration

---
 conf/lang_detection.inc                 | 10 ++++++++++
 conf/rspamd.conf                        |  6 ++++++
 src/libmime/lang_detection_fasttext.cxx |  4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/conf/lang_detection.inc b/conf/lang_detection.inc
new file mode 100644
index 000000000..ca51d2ee9
--- /dev/null
+++ b/conf/lang_detection.inc
@@ -0,0 +1,10 @@
+# Language detection configuration
+# Please don't modify this file as your changes might be overwritten with
+# the next update.
+#
+# You can modify 'local.d/lang_detection.inc' to add and merge
+# parameters defined inside this section
+#
+# You can modify 'override.d/lang_detection.inc' to strictly override all
+# parameters defined inside this section
+
diff --git a/conf/rspamd.conf b/conf/rspamd.conf
index 115fa5403..8ce93441c 100644
--- a/conf/rspamd.conf
+++ b/conf/rspamd.conf
@@ -24,6 +24,12 @@ options {
     .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/options.inc"
 }
 
+lang_detection {
+    .include "$CONFDIR/lang_detection.inc"
+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/lang_detection.inc"
+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/lang_detection.inc"
+}
+
 .include(try=true; duplicate=merge) "$CONFDIR/cgp.inc"
 .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/cgp.inc"
 
diff --git a/src/libmime/lang_detection_fasttext.cxx b/src/libmime/lang_detection_fasttext.cxx
index d6bd96ca1..9ede47a6e 100644
--- a/src/libmime/lang_detection_fasttext.cxx
+++ b/src/libmime/lang_detection_fasttext.cxx
@@ -45,10 +45,10 @@ private:
 public:
 	explicit fasttext_langdet(struct rspamd_config *cfg) {
 		const auto *ucl_obj = cfg->rcl_obj;
-		const auto *opts_section = ucl_object_find_key(ucl_obj, "options");
+		const auto *opts_section = ucl_object_find_key(ucl_obj, "lang_detection");
 
 		if (opts_section) {
-			const auto *model = ucl_object_find_key(opts_section, "fasttext_langdet_model");
+			const auto *model = ucl_object_find_key(opts_section, "fasttext_model");
 
 			if (model) {
 				try {


More information about the Commits mailing list