From 20486704172f21f6a705b9ac034e2c428754f219 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 5 Jul 2022 17:24:47 +0100 Subject: [PATCH] Exit loop if found --- content.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content.py b/content.py index 24e7afeda..c23b5e9a5 100644 --- a/content.py +++ b/content.py @@ -1023,6 +1023,7 @@ def _get_simplified_content(content: str) -> str: def detect_dogwhistles(content: str, dogwhistles: {}) -> {}: """Returns a dict containing any detected dogwhistle words """ + content = remove_html(content) result = {} words = _get_simplified_content(content).split(' ') for whistle, category in dogwhistles.items(): @@ -1078,6 +1079,7 @@ def detect_dogwhistles(content: str, dogwhistles: {}) -> {}: } else: result[whistle]['count'] += 1 + break return result