Skip to content

Commit e05a75f

Browse files
committed
fix: render the any_character function item
any_character parses as a function item, not an alias reference, and the item renderers had no branch for it — every rule guarded by before any_character + any_character was silently dropped. kp-kor's generic-suffix hyphenation (Kobi-ri) is built from such guards. Direct corpus sweep: 35 failures / 13 maps -> 16 / 10 — kp-kor (8), var-zho-wd (8) and odni-uzb (3) fully healed.
1 parent 38046a8 commit e05a75f

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎src/interscript/isc.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,8 @@ def _render_item(item: dict, aliases: dict[str, str]) -> str:
693693
if name == "line_end":
694694
return "line_end"
695695
raise UnsupportedConstruct(f"primitive {name}")
696+
if kind == "function" and item["name"] == "any_character":
697+
return "any_character"
696698
if kind == "alias_ref":
697699
name = item["name"]
698700
if item.get("map"):
@@ -759,6 +761,8 @@ def _regex_of(item: dict, aliases: dict[str, str]) -> str:
759761
"line_end": "$",
760762
"space": " ",
761763
}.get(item["name"], None) or _unsupported_primitive(item["name"])
764+
if kind == "function" and item["name"] == "any_character":
765+
return "."
762766
if kind == "alias_ref":
763767
name = item["name"]
764768
if item.get("map"):

‎tests/test_engine.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,14 @@ def test_par_unsafe_rule_forces_megaregexp_first_wins():
346346
' }\n}\n'
347347
)
348348
assert Engine(tree).transliterate("i") == "X"
349+
350+
351+
@pytest.mark.skipif(not MAPS.is_dir(), reason="interscript maps repo not present")
352+
def test_any_character_renders():
353+
"""kp-kor hyphenates generics with before any_character +
354+
any_character guards; the item renderer had no branch for the
355+
any_character function item and silently dropped every such rule
356+
(고비리 -> Kobiri instead of Kobi-ri)."""
357+
e = _load("kp-kor-Hang-Latn-2002")
358+
assert e.transliterate("고비리") == "Kobi-ri"
359+
assert e.transliterate("교구동") == "Kyogu-dong"

0 commit comments

Comments
 (0)