From 8eae217d17f8221af11f5a37d314634107db67f0 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Sat, 16 Mar 2024 15:45:59 +0100 Subject: [PATCH] Edit the condition filter on words length to include 4-letter words in index --- memory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/memory.py b/memory.py index 8350879..c681c9b 100644 --- a/memory.py +++ b/memory.py @@ -23,7 +23,8 @@ def keepOnlyAlphaChars(word): def index(text): words = re.split('\s', text) normalized_words = [keepOnlyAlphaChars(word) for word in words] - important_words = set([w for w in normalized_words if len(w) > WORD_THRESHOLD]) + important_words = set([w for w in normalized_words + if len(w) >= WORD_THRESHOLD]) return important_words def insert(db, row):