Fix s2twp greedy-match errors for 互联网络, 快闪存储器 and 老挝人民民主共和国 - #1468
Merged
frankslin merged 1 commit intoAug 1, 2026
Conversation
Add longer TWPhrases entries so shorter dictionary keys no longer split these phrases mid-word, and map 老撾人民民主共和國 to the official Taiwan name 寮人民民主共和國. TWPhrasesRev is updated to keep the reverse dictionary bidirectionally consistent while preserving existing tw2sp output. Fixes BYVoid#1467.
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.
Fixes #1467.
The three reported
s2twperrors were all caused by shorterTWPhrases.txtkeys greedily matching inside longer phrases:互联网络→網際網路絡(互聯網matched, stranding絡)快闪存储器→快快閃記憶體儲器(閃存matched mid-phrase)老挝人民民主共和国→寮國人民民主共和國(Taiwan's official name is寮人民民主共和國, without國)Changes
互聯網絡 → 網際網路,快閃存儲器 → 快閃記憶體,老撾人民民主共和國 → 寮人民民主共和國.網際網路 → 互聯網 互聯網絡,快閃記憶體 → 閃存 快閃存儲器), sotw2spstill outputs互联网/闪存as before;寮人民民主共和國 → 老撾人民民主共和國is added.issue_1467_s2twp_long_phrasesandissue_1467_tw2sp_reversecases.Verification
bazel test //data/dictionary:all //test/...passes, includingdictionary_phrases_reverse_mapping_test, the golden conversion test, and CLI tests.s2twp:互联网络 → 網際網路,快闪存储器 → 快閃記憶體,老挝人民民主共和国 → 寮人民民主共和國tw2sp(unchanged):網際網路 → 互联网,快閃記憶體 → 闪存,寮人民民主共和國 → 老挝人民民主共和国