From b6222ec4af97f8b04d50431b0a5f713227e86dbc Mon Sep 17 00:00:00 2001 From: David Pomerenke <46022183+davidpomerenke@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:04:29 +0200 Subject: [PATCH] refactor(keyword_trend.py): refine keyword topic definitions --- .../media_impact_monitor/issue_keywords.yaml | 12 ++++++---- .../trends/keyword_trend.py | 22 +++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/backend-python/media_impact_monitor/issue_keywords.yaml b/backend-python/media_impact_monitor/issue_keywords.yaml index 05d88d57..3a384218 100644 --- a/backend-python/media_impact_monitor/issue_keywords.yaml +++ b/backend-python/media_impact_monitor/issue_keywords.yaml @@ -15,15 +15,18 @@ activism: - mahnwache - hungerstreik - ziviler ungehorsam -climate_science: +climate_general: - klimawandel - klimaerwärmung - erderwärmung - klimaschutz - - klimagerechtigkeit - - klimapolitik - - klimaneutral* +climate_science: + - klimaforsch* + - klimawissenschaft* + - erderwärmung + - ipcc climate_policy: + - klimapoliti* - klimaneutral* - klimaziel* - klimaschutzpaket @@ -41,6 +44,7 @@ climate_policy: - neun-euro-ticket - vergesellschaftung - schuldenschnitt + - klimagerechtigkeit climate_urgency: - klimakrise - klimakatastrophe diff --git a/backend-python/media_impact_monitor/trends/keyword_trend.py b/backend-python/media_impact_monitor/trends/keyword_trend.py index ac414023..e7e424b5 100644 --- a/backend-python/media_impact_monitor/trends/keyword_trend.py +++ b/backend-python/media_impact_monitor/trends/keyword_trend.py @@ -56,19 +56,19 @@ def load_keywords(): def topic_queries(media_source: str) -> dict[str, str]: keywords = load_keywords() keyword_queries = { - "science": xs(keywords["climate_science"], media_source), - "policy": xs(keywords["climate_policy"], media_source), - "urgency": xs(keywords["climate_urgency"], media_source), - "all_excl_activism": xs_without_ys( - keywords["climate_science"] - + keywords["climate_policy"] - + keywords["climate_urgency"], - keywords["activism"], - media_source, - ), + "climate policy": xs(keywords["climate_policy"], media_source), + "climate science": xs(keywords["climate_science"], media_source), + "climate crisis framing": xs(keywords["climate_urgency"], media_source), + # "all_excl_activism": xs_without_ys( + # keywords["climate_science"] + # + keywords["climate_policy"] + # + keywords["climate_urgency"], + # keywords["activism"], + # media_source, + # ), } if media_source != "web_google": - keyword_queries["activism"] = xs_with_ys( + keyword_queries["climate activism"] = xs_with_ys( keywords["climate_science"] + keywords["climate_policy"] + keywords["climate_urgency"],