fix: generate interpretation string when motion path wins without ideology

main
Sven Geboers 1 month ago
parent 1ff280e0e3
commit 95c5ab9302
  1. 17
      analysis/axis_classifier.py

@ -43,6 +43,13 @@ _INTERPRETATION_TEMPLATES = {
),
}
# Maps motion-path keyword labels to _INTERPRETATION_TEMPLATES keys.
# Labels not present here fall back to "fallback".
_MOTION_LABEL_TEMPLATE_KEY: Dict[str, str] = {
"Links\u2013Rechts": "lr",
"Progressief\u2013Conservatief": "pc",
}
# Simple keyword-based classifier for motion titles (fallback signal)
_KEYWORD_THRESHOLD = 0.4
@ -512,8 +519,18 @@ def classify_axes(
if x_kw_lbl is not None:
x_lbl = x_kw_lbl
if not x_int:
tkey = _MOTION_LABEL_TEMPLATE_KEY.get(x_kw_lbl, "fallback")
x_int = _INTERPRETATION_TEMPLATES[tkey].format(
orientation="horizontale"
)
if y_kw_lbl is not None:
y_lbl = y_kw_lbl
if not y_int:
tkey = _MOTION_LABEL_TEMPLATE_KEY.get(y_kw_lbl, "fallback")
y_int = _INTERPRETATION_TEMPLATES[tkey].format(
orientation="verticale"
)
# Build display lists: [(title, date), ...]
for pole, ids in x_ids.items():

Loading…
Cancel
Save