Split tofu-risk TS character mappings into an extension table#1234
Merged
Conversation
Keep tofu-risk mappings in TSCharacters.txt as non-default candidates by making the source character the first candidate on annotated rows. This removes those rare inferred simplified forms from the default TSCharacters conversion result when the extension table is not loaded. Update extract_tofu_risk.py so TSCharactersExt.txt is generated from the same annotations while skipping the newly inserted identity candidate. The generated extension table therefore preserves the old risk mappings, allowing configurations that load it before TSCharacters.ocd2 to keep existing conversion behavior. Wire TSCharactersExt into Bazel, CMake, Node gyp, npm packaging, and the t2s/hk2s/tw2s/tw2sp configs, including the Jieba tw2sp config. The extension dictionary is generated and compiled before TSCharacters.ocd2 in those configurations so current default software behavior remains unchanged. Verified with: bazel build //data/dictionary:generate_bin_TSCharactersExt; bazel test //data/config:config_dict_validation_test; bazel test //test:command_line_converter_test; bazel test //data/dictionary:dictionary_test; bazel test //data/config:config_schema_validation_test; cmake --build build/dbg --target Dictionaries; ./node_modules/.bin/node-gyp rebuild; node scripts/prepare-node-prebuild-artifacts.js; python3 -m build --wheel. Note: npm test was also run, but it still fails existing fruit-drying testcase expectations unrelated to TSCharactersExt packaging.
Collaborator
Author
|
@danny0838 这个版本可以测试了,目前的行为保持和原来一样。把几个 json 里的 TSCharactersExt.ocd2 字典去掉,就变成不生成「豆腐块」的新行为了。 Ref: #217 |
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.
Keep tofu-risk mappings in TSCharacters.txt as non-default candidates by making the source character the first candidate on annotated rows. This removes those rare inferred simplified forms from the default TSCharacters conversion result when the extension table is not loaded.
Update extract_tofu_risk.py so TSCharactersExt.txt is generated from the same annotations while skipping the newly inserted identity candidate. The generated extension table therefore preserves the old risk mappings, allowing configurations that load it before TSCharacters.ocd2 to keep existing conversion behavior.
Wire TSCharactersExt into Bazel, CMake, Node gyp, npm packaging, and the t2s/hk2s/tw2s/tw2sp configs, including the Jieba tw2sp config. The extension dictionary is generated and compiled before TSCharacters.ocd2 in those configurations so current default software behavior remains unchanged.
Verified with: bazel build //data/dictionary:generate_bin_TSCharactersExt; bazel test //data/config:config_dict_validation_test; bazel test //test:command_line_converter_test; bazel test //data/dictionary:dictionary_test; bazel test //data/config:config_schema_validation_test; cmake --build build/dbg --target Dictionaries; ./node_modules/.bin/node-gyp rebuild; node scripts/prepare-node-prebuild-artifacts.js; python3 -m build --wheel.
Note: npm test was also run, but it still fails existing fruit-drying testcase expectations unrelated to TSCharactersExt packaging.