Skip to content

s2t: keep earthly-branch 丑 in 子丑寅卯 (not 醜)#1438

Open
stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/591-chou-earthly-branch
Open

s2t: keep earthly-branch 丑 in 子丑寅卯 (not 醜)#1438
stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/591-chou-earthly-branch

Conversation

@stantheman0128

Copy link
Copy Markdown
Contributor

Closes #591.

Problem

STCharacters.txt maps to 醜 丑, so unmatched becomes . Earthly-branch phrases such as 丁丑 / 丑时 already have STPhrases.txt self-maps, but 子丑寅卯 (and bare 子丑) did not. Result: 子丑寅卯 -> 子醜寅卯.

Change

Add identity entries in STPhrases.txt:

子丑	子丑
子丑寅卯	子丑寅卯

Do not change the character-level candidate order, so existing ugly-sense conversions (丑陋, 丑闻, 出丑, 他很丑, etc.) stay on via their phrase / character defaults.

Test plan

  • New case BYVoid_OpenCC_Issue_591_chou_earthly_branch in test/testcases/testcases.json
    • expects 子丑寅卯 / 子丑 / 丁丑 / 丑时 to keep earthly-branch
    • expects 丑陋 / 丑闻 / 出丑 / 他很丑 to keep
    • checked under s2t / s2tw / s2twp / s2hk
  • Local verification with OpenCC 1.4.1 wheel engine + this branch's text dictionaries (see Evidence)
  • CI Bazel dictionary / command_line tests (authoritative)

Evidence

Installed wheel s2t (published dicts, before this fix):

子丑寅卯 -> 子醜寅卯
子丑 -> 子醜
丁丑 -> 丁丑
丑时 -> 丑時
丑陋 -> 醜陋
丑闻 -> 醜聞
出丑 -> 出醜
他很丑 -> 他很醜

This branch, text-dict harness driving data/dictionary/*.txt through the same configs (s2t / s2tw / s2twp / s2hk):

子丑寅卯 -> 子丑寅卯
子丑 -> 子丑
丁丑 -> 丁丑
丑时 -> 丑時
丑陋 -> 醜陋
丑闻 -> 醜聞
出丑 -> 出醜
他很丑 -> 他很醜

sort.py run on STPhrases.txt after the edit (idempotent).

Please treat CI Bazel tests as authoritative; no local C++/Bazel toolchain was available here.

AI assistance

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

Issue BYVoid#591: s2t mapped bare 丑 to 醜, so 子丑寅卯 became 子醜寅卯.
Add STPhrases self-maps for 子丑寅卯 / 子丑 (same pattern as 丁丑, 丑时)
and a testcase that still expects 醜 for 丑陋 / 丑闻 / 出丑 / 他很丑.

Co-authored-by: Cursor <cursoragent@cursor.com>
@frankslin

Copy link
Copy Markdown
Collaborator

感謝貢獻。關於這個 ticket,我覺得,最好將所有合法的帶有「丑」的干支組合全部加入。
也要逐個判斷會不會造成特殊歧義。

@frankslin frankslin closed this Jul 17, 2026
@frankslin frankslin reopened 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.

子「丑」寅卯->子「醜」寅卯

2 participants