Fix en/de mode edge case on docs without detected English column
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 25s
CI / test-go-edu-search (push) Successful in 27s
CI / test-python-klausur (push) Failing after 1m54s
CI / test-python-agent-core (push) Successful in 15s
CI / test-nodejs-website (push) Successful in 17s

When no IPA signals exist (e.g. German-only dicts), the fallback
that guesses en_col_type was incorrectly triggered for en/de modes,
causing false IPA and syllable insertions. Now only fires for 'all'
mode. Syllable en mode also returns empty set when no EN column found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-25 08:37:15 +01:00
parent 83c058e400
commit 7773c51304

View File

@@ -889,8 +889,8 @@ async def _build_grid_core(
col_ipa_count[ct] = col_ipa_count.get(ct, 0) + 1
if col_ipa_count:
en_col_type = max(col_ipa_count, key=col_ipa_count.get)
elif ipa_mode in ("all", "de", "en"):
# Force mode without auto-detection: pick column with most cells
elif ipa_mode == "all":
# Force-all mode without auto-detection: pick column with most cells
col_cell_count: Dict[str, int] = {}
for cell in all_cells:
ct = cell.get("col_type", "")
@@ -1510,10 +1510,12 @@ async def _build_grid_core(
_syllable_eligible = True
# For language-specific modes, determine allowed columns
_syllable_col_filter: Optional[set] = None # None = all columns
if syllable_mode == "en" and en_col_type:
_syllable_col_filter = {en_col_type}
elif syllable_mode == "de" and en_col_type:
_syllable_col_filter = all_content_cols - {en_col_type} if total_cols >= 3 else None
if syllable_mode == "en":
_syllable_col_filter = {en_col_type} if en_col_type else set()
elif syllable_mode == "de":
if en_col_type and total_cols >= 3:
_syllable_col_filter = all_content_cols - {en_col_type}
# else None → all columns (correct for German-only dicts)
if _syllable_eligible:
try:
from cv_syllable_detect import insert_syllable_dividers