Skip to content

Commit

Permalink
refactor: use set comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieboldianus committed Nov 4, 2019
1 parent a4c5f6d commit 8f65af6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tagmaps/classes/utils.py
Expand Up @@ -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

Expand Down

0 comments on commit 8f65af6

Please sign in to comment.