From 8f65af61ea0567897c692ee5947ff43186a39a15 Mon Sep 17 00:00:00 2001 From: Alexander Dunkel Date: Mon, 4 Nov 2019 08:26:58 +0100 Subject: [PATCH] refactor: use set comprehension --- tagmaps/classes/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tagmaps/classes/utils.py b/tagmaps/classes/utils.py index 02d9228..4c5c05c 100644 --- a/tagmaps/classes/utils.py +++ b/tagmaps/classes/utils.py @@ -183,13 +183,15 @@ def remove_special_chars(text_s): def select_words(text_s, selection_list: List[str]) -> str: """Filters a string based on a provided positive filter list of terms + + - removes duplicate terms """ # first remove hyperlinks text_s = Utils.remove_hyperlinks(text_s) # split string by space character into list querywords = text_s.split() - resultwords = [word for word in querywords if word.lower() - in selection_list] + resultwords = {word for word in querywords if word.lower() + in selection_list} s_cleaned = ' '.join(resultwords) return s_cleaned