Skip to content

s2t: prefer 沖 over 衝 as the default candidate for 冲 - #1434

Closed
stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/984-chong-variant
Closed

stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/984-chong-variant

Conversation

@stantheman0128

Copy link
Copy Markdown
Contributor

Closes #984.

Problem

Simplified 冲 merges two traditional characters: 沖 (rinse / flush / brew) and 衝 (charge / collide / impulse). On current master, STCharacters.txt prefers 衝:

冲	衝 沖

That makes unmatched 冲 convert to 衝, which is wrong for everyday rinse/brew uses such as 冲咖啡. Issue #984 was retitled from 冲 --> 衝 to 冲 --> 沖 (衝), asking for 沖 as the default candidate and 衝 as the non-default alternative. Phrase-level 衝 senses are already covered in STPhrases.txt (for example 水一冲 -> 水一衝, 冲突 -> 衝突).

Change

  • STCharacters.txt: swap the s2t candidate order for 冲 from 衝 沖 to 沖 衝, following CONTRIBUTING.md (keep the old conversion as a non-default candidate) and the precedent of s2t: fix 托/託 candidate priority so 托 stays unconverted by default #1405.
  • testcases.json: add BYVoid_OpenCC_Issue_984_chong_variant_priority covering default 沖 uses, the issue example 清水一冲 -> 清水一衝, and common 衝 compounds.

No STPhrases.txt edits were required; existing phrase entries already pin the 衝 senses.

Verification

I had no C++ toolchain available, so I verified with the OpenCC 1.4.1 wheel engine driving this branch's text dictionaries directly: config JSONs identical to data/config/*.json with ocd2 references switched to text. There are no conversion related engine changes between ver.1.4.1 and master for this character mapping. A/B against master dictionaries with the same harness:

new Issue_984 testcase on master dictionaries:  FAIL (冲咖啡 -> 衝咖啡)
new Issue_984 testcase on this branch:          PASS (冲咖啡 -> 沖咖啡; 清水一冲 -> 清水一衝)
existing testcases.json expectations A/B:       same 462 pass / 31 fail on both
                                                (the 31 fails are from omitted generated
                                                regional/rev dictionaries in the local
                                                text harness, not from this diff)
sort.py on STCharacters.txt:                    mapping remains 冲<TAB>沖 衝

Sample before/after (s2t; base = master, mod = this branch):

冲                          base=衝            mod=沖
冲咖啡                      base=衝咖啡        mod=沖咖啡
冲洗                        base=沖洗          mod=沖洗
清水一冲                    base=清水一衝      mod=清水一衝
再用清水一冲就能清除了      base=再用清水一衝就能清除了  mod=再用清水一衝就能清除了
冲突                        base=衝突          mod=衝突
冲动                        base=衝動          mod=衝動
冲锋                        base=衝鋒          mod=衝鋒
缓冲                        base=緩衝          mod=緩衝
兴冲冲                      base=興沖沖        mod=興沖沖

Please treat the CI Bazel dictionary tests as the authoritative check.

This fix was developed with AI assistance (Cursor/Grok) and verified locally as shown above.

Issue BYVoid#984 retitled the desired mapping to 冲 -> 沖 (衝). Keep 衝 as a
non-default candidate so existing STPhrases entries such as 水一冲 and
冲突 still convert correctly.
@frankslin frankslin closed this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s2t 冲 --> 沖 (衝)

2 participants