max_score = 20.0;
read_only = yes;
skip_unknown = yes;
- short_text_direct_hash = true;
+ short_text_direct_hash = true; # If less than min_length then use direct hash
+ min_length = 64; # Minimum words count to consider shingles
fuzzy_map = {
FUZZY_DENIED {
max_score = 20.0;
if rule.text_shingles then
-- Check number of words
- if rule.min_length > 0 and wcnt < rule.min_length then
+ local min_words = rule.min_length or 0
+ if min_words < 32 then
+ min_words = 32 -- Minimum for shingles
+ end
+ if wcnt < min_words then
lua_util.debugm(N, task, 'text has less than %s words: %s; disable shingles',
rule.min_length, wcnt)
allow_shingles = false
else
lua_util.debugm(N, task, 'allow shingles in text %s, %s words',
id, wcnt)
- allow_shingles = wcnt > 0
+ allow_shingles = true
end
if not rule.short_text_direct_hash and not allow_shingles then
local function has_sane_text_parts(task)
local text_parts = task:get_text_parts() or {}
- return fun.any(function(tp) return tp:get_words_count() > 10 end, text_parts)
+ return fun.any(function(tp) return tp:get_words_count() > 32 end, text_parts)
end
local function check_image_part(task, part, rule, image)