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