Add macro zone grouping (6 groups) as map default

Nine fine IW zones over-fragment low-dimensional maps: English-speaking + the
European religions (Protestant/Catholic/Baltic) don't separate, and 'Confucian'
reads oddly for Japan. IW_MACRO collapses to 6 principled groups (West, Orthodox,
East Asia, Latin America, African-Islamic, South Asia); zones_for(macro=True) is
the default, macro=False keeps the principled 9. mfq2/big5 read much cleaner; 16pf
still overlaps (that instrument doesn't separate cultures).

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-07-04 20:40:28 +08:00
co-authored by Claudypoo
parent f39a0763ab
commit b2b8b00b5e
2 changed files with 22 additions and 5 deletions
+7 -2
View File
@@ -81,12 +81,17 @@ C_BASE, C_HON, C_DIS, C_HUM = "#111111", POS_COL, NEG_COL, "#888888"
# instrument's map (research consistency). Keyed by the zone names the caller passes; an unlisted
# zone falls back to grey. -- added by Claude
ZONE_COLORS = {
"English-Speaking": "#4e79a7",
# macro zones (map default)
"West": "#4e79a7",
"East Asia": "#e15759",
# fine zones (macro=False)
"English-Speaking": "#4e79a7",
"Protestant Europe": "#59a14f",
"Catholic Europe": "#8cd17d",
"Orthodox": "#b6992d",
"Baltic": "#499894",
"Confucian": "#e15759",
# shared by both groupings
"Orthodox": "#b6992d",
"Latin America": "#f28e2b",
"African-Islamic": "#9c755f",
"South Asia": "#b07aa1",
+15 -3
View File
@@ -78,6 +78,16 @@ _CANON = {
ECONOMIST_OUTLIERS = {"China", "South Korea", "United States", "Great Britain", "Japan",
"Nigeria", "Pakistan", "Sweden"}
# Coarser macro-zones for the maps. The nine fine IW zones over-fragment low-dimensional maps: the
# English-speaking world and the European religions (Protestant/Catholic/Baltic) don't separate, so
# they merge into one "West"; "Confucian" reads oddly for Japan/Korea, so it's the plainer "East
# Asia". Fewer, better-separated blobs. -- authored by Claude
IW_MACRO = {
"English-Speaking": "West", "Protestant Europe": "West", "Catholic Europe": "West",
"Baltic": "West", "Orthodox": "Orthodox", "Confucian": "East Asia",
"Latin America": "Latin America", "African-Islamic": "African-Islamic", "South Asia": "South Asia",
}
def zone_of(country: str) -> str | None:
"""IW zone of a verbatim country string, or None for a known-corrupt row. KeyErrors (fail loud)
@@ -86,9 +96,11 @@ def zone_of(country: str) -> str | None:
return None if canon is None else IW_ZONE[canon]
def zones_for(countries: list[str]) -> tuple[dict[str, list[str]], set[str]]:
def zones_for(countries: list[str], macro: bool = True) -> tuple[dict[str, list[str]], set[str]]:
"""Group verbatim country strings by IW zone + the subset to emphasize (Economist outliers).
Known-corrupt rows are dropped with a warning; unrecognised countries KeyError via zone_of."""
`macro` (default) collapses the nine fine zones to six broader ones (IW_MACRO) so low-dimensional
maps aren't over-fragmented. Known-corrupt rows are dropped with a warning; unrecognised countries
KeyError via zone_of."""
groups: dict[str, list[str]] = {}
dropped: list[str] = []
emph: set[str] = set()
@@ -97,7 +109,7 @@ def zones_for(countries: list[str]) -> tuple[dict[str, list[str]], set[str]]:
if z is None:
dropped.append(c)
continue
groups.setdefault(z, []).append(c)
groups.setdefault(IW_MACRO[z] if macro else z, []).append(c)
if _CANON.get(c, c) in ECONOMIST_OUTLIERS:
emph.add(c)
if dropped: