From 9ac7f79ec951415d6424264587c8683380f8187d Mon Sep 17 00:00:00 2001 From: Mathias Dail <93382891+MathiasExorde@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:12:06 +0100 Subject: [PATCH] Update extract_keywords.py --- exorde/extract_keywords.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exorde/extract_keywords.py b/exorde/extract_keywords.py index 1f9cc3e..9dc0dd4 100644 --- a/exorde/extract_keywords.py +++ b/exorde/extract_keywords.py @@ -183,6 +183,9 @@ def process_keywords(keywords): else: # If the keyword is already lowercase, keep it as is processed_keywords.append(keyword) + + # Remove case-sensitive duplicates + return list(dict.fromkeys(processed_keywords)) def extract_keywords(translation: Translation) -> Keywords: content: str = translation.translation @@ -211,4 +214,4 @@ def extract_keywords(translation: Translation) -> Keywords: keywords_ = process_keywords(keywords_) except Exception as e: print(f"Error in advanced keywords extraction: {e}") - return Keywords(list(set(keywords_))) + return Keywords(list(keywords_))