Repository navigation
s2t: protect 人参加 from 人参 to 人蔘 ginseng match (#890) - #1440
Closed
stantheman0128 wants to merge 1 commit into
Closed
stantheman0128 wants to merge 1 commit into
stantheman0128 wants to merge 1 commit into
Conversation
Keep the plant mapping 人参 -> 人蔘, and add longer STPhrases entries so MaxMatch prefers 人参加 / 人参与 / 人参观 and other common 人参* verbs over the two-character ginseng entry (fixes s2t and s2hk; s2tw already recovered via TWVariants 蔘->參). Co-authored-by: Cursor <cursoragent@cursor.com>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #890.
Problem
When a person-count 「人」 is immediately followed by verbs that start with 「参」 (参加 / 参与 / 参观 / ...), default (non-jieba) conversion matches the shorter STPhrases entry 「人参 -> 人蔘」 first:
s2tw / s2twp already look correct because TWVariants maps 「蔘 -> 參」 after the fact. Collaborator frankslin noted on the issue that s2hk is the regional mode that still shows the wrong form; HEAD also reproduces the same MaxMatch miss on plain s2t.
Related background: #258 (closed by adding TWVariants 「蔘->參」), which fixed Taiwan paths but not s2t / s2hk.
Change
Keep 「人参 -> 人蔘」 (and 人参果 / 人参精) for the plant reading.
Add longer STPhrases entries so MaxMatch prefers the verb reading:
Same longer-phrase-wins pattern as #1433 (是只有 vs 是只). Dictionary sorted with
python data/scripts/sort.py data/dictionary/STPhrases.txt.Test plan
BYVoid_OpenCC_Issue_890_*intest/testcases/testcases.jsonEvidence
Repro before (packaged wheel dictionaries = current published behavior):
After this branch (config JSONs with ocd2 refs switched to text, driving
data/dictionary/*.txton the branch):A/B of existing
s2texpectations intestcases.json(branch STPhrases vs expectations, excluding the new #890 cases): 92/92 same, 0 diffs.sort.pyidempotence onSTPhrases.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.