From db27192027fea33d0afff0d79abedee2a912eb9c Mon Sep 17 00:00:00 2001 From: "David S. Batista" Date: Mon, 29 Apr 2024 17:37:15 +0200 Subject: [PATCH] fixing linting issues and mypy --- haystack/document_stores/in_memory/document_store.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/haystack/document_stores/in_memory/document_store.py b/haystack/document_stores/in_memory/document_store.py index 86295cb42f..fce202f336 100644 --- a/haystack/document_stores/in_memory/document_store.py +++ b/haystack/document_stores/in_memory/document_store.py @@ -151,8 +151,8 @@ def _compute_tf(token: str, freq: Dict[str, int], doc_len: int) -> float: doc_len = doc_stats.doc_len score = 0.0 - for tok, idf_score in idf.keys(): - score += idf_score * _compute_tf(tok, freq, doc_len) + for tok in idf.keys(): # pylint: disable=consider-using-dict-items + score += idf[tok] * _compute_tf(tok, freq, doc_len) ret.append((doc, score)) return ret @@ -259,8 +259,8 @@ def _compute_tf(token: str, freq: Dict[str, int], doc_len: float) -> float: doc_len = doc_stats.doc_len score = 0.0 - for tok, idf_score in idf.keys(): - score += idf_score * _compute_tf(tok, freq, doc_len) + for tok in idf.keys(): # pylint: disable=consider-using-dict-items + score += idf[tok] * _compute_tf(tok, freq, doc_len) ret.append((doc, score)) return ret