Skip to content

s2t: add STPhrases MaxMatch fixes from issue #886 - #1453

Closed
stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/886-stphrases
Closed

stantheman0128 wants to merge 1 commit into
BYVoid:masterfrom
stantheman0128:fix/886-stphrases

Conversation

@stantheman0128

Copy link
Copy Markdown
Contributor

Closes #886.

Problem

Issue #886 and its comments list many STPhrases gaps where shorter MaxMatch entries win over the intended reading. Examples on current packaged dictionaries:

地瓜干 -> 地瓜幹   (want 地瓜乾, same pattern as 葡萄干)
观影后 -> 觀影后   (影后 identity wins; want 觀影後)
控球后卫 -> 控球后衛 (球后 identity wins; want 控球後衛)
年历史 -> 年曆史   (年历 wins; want 年歷史)
天干完 -> 天干完   (天干 wins over 干完; want 天幹完)
得力干将 -> 得力干將 (干将 sword name wins; want 得力幹將)
落地签 / 免签 -> 籤 (character default; want 簽)
纤道 -> 纖道       (want 縴道, same as 纤夫)
并兼任 -> 併兼任   (并兼 wins; want 並兼任)
仲裁制 -> 仲裁製   (裁制 wins; want 仲裁制)
在海里 -> 在海里   (海里 nautical-mile default; want 在海裏)
余华 -> 餘華       (want surname 余華)

Issue body also proposed 干云蔽日 -> 乾雲蔽日. The cited MoE entry (ID 69701) and the 《後漢書》 quote both use 干雲蔽日, and OpenCC already maps 干云蔽日 -> 干雲蔽日. This PR leaves that entry unchanged.

Change

Add longer / clearer STPhrases entries for the reproducible cases above (dried foods, after-compounds, history vs calendar, gan/visa/tow/system/sea/name), plus controls so 影后 / 武后 / 球后 / 封后 / 天干 / 干将莫邪 / 年历 / 裁制 stay as they are.

Dictionary sorted with python data/scripts/sort.py data/dictionary/STPhrases.txt.

Test plan

  • New cases BYVoid_OpenCC_Issue_886_* in test/testcases/testcases.json
  • Local verification with OpenCC 1.4.1 wheel + branch text dictionaries (see Evidence)
  • CI Bazel dictionary / command_line tests (authoritative)

Evidence

Repro before (packaged wheel dictionaries):

s2t: 地瓜干 -> 地瓜幹
s2t: 观影后 -> 觀影后
s2t: 控球后卫 -> 控球后衛
s2t: 年历史 -> 年曆史
s2t: 天干完 -> 天干完
s2t: 得力干将 -> 得力干將
s2t: 落地签 -> 落地籤
s2t: 免签 -> 免籤
s2t: 纤道 -> 纖道
s2t: 并兼任 -> 併兼任
s2t: 仲裁制 -> 仲裁製
s2t: 在海里 -> 在海里
s2t: 余华 -> 餘華
s2t: 干云蔽日 -> 干雲蔽日

After this branch (config JSONs with ocd2 refs switched to text, driving data/dictionary/*.txt on the branch):

s2t: 地瓜干 -> 地瓜乾
s2t: 观影后 -> 觀影後
s2t: 控球后卫 -> 控球後衛
s2t: 年历史 -> 年歷史
s2t: 天干完 -> 天幹完
s2t: 得力干将 -> 得力幹將
s2t: 落地签 -> 落地簽
s2t: 免签 -> 免簽
s2t: 纤道 -> 縴道
s2t: 并兼任 -> 並兼任
s2t: 仲裁制 -> 仲裁制
s2t: 在海里 -> 在海裏
s2t: 余华 -> 余華
s2t: 干云蔽日 -> 干雲蔽日

New #886 cases: 9/9 pass under s2t / s2tw / s2twp / s2hk.

A/B of existing s2t expectations in testcases.json (branch STPhrases vs expectations, excluding the new #886 cases): 93/93 same, 0 diffs.

sort.py idempotence on STPhrases.txt: no diff.

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.

Longer phrases for dried foods, after-compounds, history vs calendar,
gan/visa/tow/system cases, without changing MoE 干云蔽日.

Co-authored-by: Cursor <cursoragent@cursor.com>
@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.

Update STPhrases.txt

2 participants