Fix IPA marker split: walk back max 3 chars for onset cluster

The walk-back was going 4 chars, eating the last letter of the
headword: "schoolbag" → "schoolba". Limiting to 3 gives correct
split: "schoolbag" + "[sku:lbæg]".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-19 10:57:15 +01:00
parent cc5ee74921
commit 2e6ab3a646

View File

@@ -1073,7 +1073,7 @@ def _insert_missing_ipa(text: str, pronunciation: str = 'british') -> str:
if first_marker >= 3:
split = first_marker
while (split > 0
and split > first_marker - 4
and split > first_marker - 3
and w[split - 1].isalpha()
and w[split - 1].islower()):
split -= 1