aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-12-07 15:40:08 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-12-07 15:40:08 +0000
commit752414a1f585b5ad3b03d812eb2aa995e899e9b3 (patch)
tree70faa7e3b483118473fa83c8f10ba59795a09d40 /lualib
parent51e123f58ff32e362ba35f077d37e3a7d04de5a5 (diff)
downloadrspamd-752414a1f585b5ad3b03d812eb2aa995e899e9b3.tar.gz
rspamd-752414a1f585b5ad3b03d812eb2aa995e899e9b3.zip
[Project] Add some basic learning
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_bayes_redis.lua2
-rw-r--r--lualib/redis_scripts/bayes_learn.lua4
2 files changed, 3 insertions, 3 deletions
diff --git a/lualib/lua_bayes_redis.lua b/lualib/lua_bayes_redis.lua
index 2286295d5..ee4ec80b6 100644
--- a/lualib/lua_bayes_redis.lua
+++ b/lualib/lua_bayes_redis.lua
@@ -54,7 +54,7 @@ local function gen_learn_functor(redis_params, learn_script_id)
lua_redis.exec_redis_script(learn_script_id,
{ task = task, is_write = false, key = expanded_key },
- learn_redis_cb, { expanded_key, is_spam, symbol, is_unlearn, stat_tokens })
+ learn_redis_cb, { expanded_key, tostring(is_spam), symbol, tostring(is_unlearn), stat_tokens })
end
end
diff --git a/lualib/redis_scripts/bayes_learn.lua b/lualib/redis_scripts/bayes_learn.lua
index 2b74fcca9..638254706 100644
--- a/lualib/redis_scripts/bayes_learn.lua
+++ b/lualib/redis_scripts/bayes_learn.lua
@@ -7,9 +7,9 @@
-- key5 - set of tokens encoded in messagepack array of int64_t
local prefix = KEYS[1]
-local is_spam = KEYS[2]
+local is_spam = KEYS[2] == 'true' and true or false
local symbol = KEYS[3]
-local is_unlearn = KEYS[4]
+local is_unlearn = KEYS[4] == 'true' and true or false
local input_tokens = cmsgpack.unpack(KEYS[5])
local prefix_underscore = prefix .. '_'