Skip to content

Declare phrase-level character mapping dependencies - #1282

Merged
frankslin merged 1 commit into
BYVoid:masterfrom
frankslin:test-phrases-and-characters
Jun 7, 2026
Merged

frankslin merged 1 commit into
BYVoid:masterfrom
frankslin:test-phrases-and-characters

Conversation

@frankslin

@frankslin frankslin commented Jun 5, 2026 •

Copy link
Copy Markdown
Collaborator

Phrase dictionaries can continue to convert a character A to B even after the corresponding character-level A-to-B rule has been removed. That makes the remaining phrase entries an implicit dependency and can hide the fact that A-to-B is still supported in specific words.

Add a dictionary test that compares equal-length phrase mappings with their corresponding character dictionaries. Whenever a phrase maps A to B at the same character position, the character dictionary must still list B as a candidate for A. If B should no longer be the default, the dictionary should keep it as a non-default candidate such as AA B rather than deleting it outright.

Backfill the currently implicit ST, TS, and HK character candidates and add the reverse variant identity exceptions required by the expanded character candidate sets. Document the maintenance rule in CONTRIBUTING.md.

Phrase dictionaries can continue to convert a character A to B even after the corresponding character-level A-to-B rule has been removed. That makes the remaining phrase entries an implicit dependency and can hide the fact that A-to-B is still supported in specific words.

Add a dictionary test that compares equal-length phrase mappings with their corresponding character dictionaries. Whenever a phrase maps A to B at the same character position, the character dictionary must still list B as a candidate for A. If B should no longer be the default, the dictionary should keep it as a non-default candidate such as A<TAB>A B rather than deleting it outright.

Backfill the currently implicit ST, TS, and HK character candidates and add the reverse variant identity exceptions required by the expanded character candidate sets. Document the maintenance rule in CONTRIBUTING.md.
@frankslin
frankslin force-pushed the test-phrases-and-characters branch from e0e5e77 to f12d9e8 Compare June 6, 2026 18:45
@frankslin frankslin changed the title Add phrase dependency test for character mappings Declare phrase-level character mapping dependencies Jun 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f12d9e8698

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread data/dictionary/BUILD.bazel
@frankslin
frankslin merged commit 490dace into BYVoid:master Jun 7, 2026
31 of 34 checks passed
@frankslin
frankslin deleted the test-phrases-and-characters branch June 7, 2026 02:21
@skyuns

skyuns commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

STPhrases.txt 的下列三條可能有點問題。
1. 呆着 待著
OpenCC 預設的"着"的繁體字是"着",除非是"著名"的"著"(zhu四聲)。
所以右邊應該不正確,應該是"待着"。
s2tw,透過TWVariants才轉為"待著"

另外,"呆"是不是適合轉為繁體"待" ,不在此討論。

2.切面 切面 切麵
3.制面 製麵

右邊繁體字,"麵" OpenCC 預設應該是"麪"
s2tw,透過TWVariants才轉為"麵"

如果上述正確,則PR新增的TWVariantsRevPhrases.txt下列兩條也要評估應該怎麼修改。
待著 待著
製麵 製麵

@danny0838

Copy link
Copy Markdown
Contributor

我開了 #1288 處理相關問題。

@frankslin

Copy link
Copy Markdown
Collaborator Author

感谢讨论。

关于「呆着 / 待着」我的理解是,如果「呆着」是一个台湾、香港都接受的正确写法,这里其实应当保留而不是转换为另一个可以接受的词。

另外,关于「著/着」,虽然以前讨论过多次,不记得有没有人贴过这篇文章的链接:
「著」是如何变成「着」的? - 趙瑾昀的回答 - 知乎

我理解 OpenCC 中合理的做法可能是:
「着」「著」应该在「s2t」层保持分开,在 t2tw 层再合并为「著」。
反过来做 tw->t->s 转换时,第一步先通过词组尽量拆分回「着」「著」,并接受不可能做到 100% 无损转化的现实。


此文作者的观点总结如下:

「著」与「着」的关系总结

字形来源

「着」并非简化字,而是「著」在书法书写中自然演变出的俗体变体:

  • 「艹」头写成「䒑」后与下方笔画粘连,形成「羊」形
  • 「日」部讹变为「目」形
  • 最终演变为「羊」+「目」构成的「着」
  • 两字笔画数完全相同(均为11画),非简繁关系。

读音与职能分化

「著」历史上有多个读音,主要分两类:

  • 去声(zhù):表示"显著"、"著作"等义
  • 入声(zhuó):表示"附着"、"穿着"等义

为区分这两类读音,人们逐渐约定俗成:去声用「著」,入声用「着」。这一分化在明代字书中已有记录。

各地规范比较

地区 规范
中国大陆 「著」(zhù)与「着」(zhuó/zhe)分用
香港 同上,分用
日本 同上(如「著作権」vs「着陸」)
台湾 一律用「著」,不用「着」

有趣的例外

「土著」一词,按中古汉语读音本应读入声,理论上大陆和香港也该写「土着」,日本确实如此写(土着)。

@danny0838

danny0838 commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

就如在 #1281 (comment) 提過的,許多字本來就不應該在 s2t/t2s 做處理。

「呆/待」本來就無繁簡字或異體字關係,本質上就不是簡繁轉換的範疇。

「待著/待在」、「呆著/呆在」台灣都會用,但意義不同,「待著/待在」是單純「停留/等待」的意思,「呆著/呆在」則比較有「發楞/發悶」的意思。

中國大陸似乎也是二者都用,但「呆著/呆在」常常也用在單純「停留/等待」。

二者是細微的語感和使用傾向不同,但並無絕對性,可以考慮做地區詞彙轉換,但恐怕也很難準確。

其他如這次引進的「具/俱」、「坐/座」也都不是繁簡關係,應該要擇日修正這些歷史錯誤,不過最好等 s2hkp 處理好再做,否則不便處理香港的詞彙轉換。

「穗/繐」、「筱/篠」、「耇/耈」非《通規》定義的繁簡字或異體字,但有異體字關係,並非絕對不能在 s2t/t2s 處理,只是可能要先釐清異體關係及各地實際使用情況。

frankslin pushed a commit that referenced this pull request Jun 7, 2026
* 修正不當簡繁轉換: 着、麵、飮、鯰

- 着:OpenCC 正體取「着」「著」,修正不當互轉的相關詞項。
- 麵:OpenCC 正體取「麪」,修正誤輸出異體字「麵」的相關詞項。
- 飮:OpenCC 正體取「飲」,修正誤輸出異體字「飮」的相關詞項。
- 鯰:OpenCC 既有「鯰/鲶」「鮎/鲇」,修正不當互轉的相關詞項。

* 移除不當簡繁轉換: 蔽 => 庇

- 「蔽」、「庇」並非繁簡或異體字關係,不宜互轉
- 傳統中文通常用「蔭蔽」(偏向遮蔽義)或「蔭庇」、「廕庇」(偏向庇護義),原則上不用「廕蔽」
- 中國大陸將「蔭」、「廕」簡化為「荫」,習慣用「荫蔽」、「荫庇」

* 移除不當簡繁轉換: 酰 => 醯

- 二字非簡化字或異體字關係。化學 Acyl group 台灣稱「醯基」,中國大陸習用「酰基」,屬地區詞轉換,亦已收錄於 TWPhrases 之中。
- 修正 谷氨酰胺(s) => 穀氨酰胺(t) => 麩醯胺酸(tw) 轉換
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.

3 participants