Odsiewanie szumu + rozwijanie skrótów sygnifikatorów

- abbreviations.py: słownik skrót -> pełna nazwa (z SIGNIFICATORS KEY, built-in)
  + expand(): [Su in [Tau -> "Sun in Taurus", [Sa in 6th H. -> "...6th house",
  affl. -> afflicted itd.
- significators: każda próbka ma pole "expanded" (postać czytelna); hartowanie
  filtra szumu (efekty zastępcze x/?/-, wiersze *MARKER, legendy/nagłówki).
- prezentacja /interpret: pokazuje rozwiniętą postać, surowy skrót w tooltipie.

Zweryfikowano na realnym main_base.xlsx: "[Sa or [Ma in the 5th H." ->
"Saturn or Mars in the 5th house". 9 testów przechodzi (w tym test_abbreviations).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 15:42:47 +02:00
parent 0e74566a78
commit 82809665ff
6 changed files with 90 additions and 5 deletions
+7 -4
View File
@@ -13,6 +13,7 @@ from __future__ import annotations
from typing import Any, Protocol
from app.abbreviations import expand
from app.engine.formats import SIGN_ABBR, SIGNS
PLANET_ABBR = {
@@ -38,11 +39,13 @@ def _effect(row: dict) -> str:
def _is_noise(sig: str, effect: str) -> bool:
s = sig.strip().lower()
e = effect.strip().lower()
return (
not effect
or s.startswith("significator")
e in ("", "nan", "x", "x?", "?", "-") # efekt pusty/zastępczy
or s.startswith("significator") # wiersz-legenda/nagłówek
or "header" in s
or s in ("x", "x?", "nan")
or s.startswith("*") # *MARKER / *header
or s in ("x", "x?", "nan") # znacznik „pomiń rekord"
)
@@ -65,7 +68,7 @@ def _facet_samples(rows: list[dict], token: str, limit: int = 4) -> list[dict]:
eff = _effect(r)
if _is_noise(sig, eff):
continue
out.append({"significator": sig.strip(), "effect": eff})
out.append({"significator": sig.strip(), "expanded": expand(sig.strip()), "effect": eff})
return out