zhhz 0.7.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. zhhz-0.7.8/.gitignore +12 -0
  2. zhhz-0.7.8/CONTRIBUTING.md +40 -0
  3. zhhz-0.7.8/Cargo.lock +414 -0
  4. zhhz-0.7.8/Cargo.toml +75 -0
  5. zhhz-0.7.8/LICENSE +201 -0
  6. zhhz-0.7.8/PKG-INFO +276 -0
  7. zhhz-0.7.8/README.cn.md +201 -0
  8. zhhz-0.7.8/README.md +248 -0
  9. zhhz-0.7.8/RELEASE-v0.7.1.md +115 -0
  10. zhhz-0.7.8/RELEASE-v0.7.2.md +107 -0
  11. zhhz-0.7.8/RELEASE-v0.7.3.md +130 -0
  12. zhhz-0.7.8/RELEASE-v0.7.4.md +124 -0
  13. zhhz-0.7.8/RELEASE-v0.7.5.md +93 -0
  14. zhhz-0.7.8/RELEASE-v0.7.7.md +103 -0
  15. zhhz-0.7.8/RELEASE-v0.7.8.md +114 -0
  16. zhhz-0.7.8/ROADMAP.md +80 -0
  17. zhhz-0.7.8/SECURITY.md +16 -0
  18. zhhz-0.7.8/build.rs +335 -0
  19. zhhz-0.7.8/changelog/v0.0.1.test.cn.md +28 -0
  20. zhhz-0.7.8/changelog/v0.0.1.test.md +28 -0
  21. zhhz-0.7.8/changelog/v0.1.0.cn.md +19 -0
  22. zhhz-0.7.8/changelog/v0.1.0.md +29 -0
  23. zhhz-0.7.8/changelog/v0.2.0.cn.md +23 -0
  24. zhhz-0.7.8/changelog/v0.2.0.md +48 -0
  25. zhhz-0.7.8/changelog/v0.3.0.cn.md +45 -0
  26. zhhz-0.7.8/changelog/v0.3.0.md +48 -0
  27. zhhz-0.7.8/changelog/v0.4.0.cn.md +36 -0
  28. zhhz-0.7.8/changelog/v0.4.0.md +44 -0
  29. zhhz-0.7.8/changelog/v0.6.0.md +53 -0
  30. zhhz-0.7.8/changelog/v0.7.0.cn.md +79 -0
  31. zhhz-0.7.8/changelog/v0.7.0.md +82 -0
  32. zhhz-0.7.8/changelog/v0.7.1.cn.md +66 -0
  33. zhhz-0.7.8/changelog/v0.7.1.md +67 -0
  34. zhhz-0.7.8/changelog/v0.7.2.cn.md +85 -0
  35. zhhz-0.7.8/changelog/v0.7.2.md +89 -0
  36. zhhz-0.7.8/changelog/v0.7.3.cn.md +93 -0
  37. zhhz-0.7.8/changelog/v0.7.3.md +97 -0
  38. zhhz-0.7.8/changelog/v0.7.4.cn.md +86 -0
  39. zhhz-0.7.8/changelog/v0.7.4.md +92 -0
  40. zhhz-0.7.8/changelog/v0.7.5.cn.md +102 -0
  41. zhhz-0.7.8/changelog/v0.7.5.md +109 -0
  42. zhhz-0.7.8/changelog/v0.7.7.cn.md +98 -0
  43. zhhz-0.7.8/changelog/v0.7.7.md +100 -0
  44. zhhz-0.7.8/changelog/v0.7.8.cn.md +122 -0
  45. zhhz-0.7.8/changelog/v0.7.8.md +140 -0
  46. zhhz-0.7.8/changelog/v0.7.8.test.cn.md +28 -0
  47. zhhz-0.7.8/changelog/v0.7.8.test.md +28 -0
  48. zhhz-0.7.8/data/UPSTREAM +15 -0
  49. zhhz-0.7.8/data/config/hk2s.json +32 -0
  50. zhhz-0.7.8/data/config/hk2sp.json +33 -0
  51. zhhz-0.7.8/data/config/hk2t.json +18 -0
  52. zhhz-0.7.8/data/config/jp2t.json +18 -0
  53. zhhz-0.7.8/data/config/opencc_config.schema.json +100 -0
  54. zhhz-0.7.8/data/config/s2hk.json +40 -0
  55. zhhz-0.7.8/data/config/s2hkp.json +41 -0
  56. zhhz-0.7.8/data/config/s2t.json +31 -0
  57. zhhz-0.7.8/data/config/s2tw.json +40 -0
  58. zhhz-0.7.8/data/config/s2twp.json +41 -0
  59. zhhz-0.7.8/data/config/t2hk.json +24 -0
  60. zhhz-0.7.8/data/config/t2jp.json +6 -0
  61. zhhz-0.7.8/data/config/t2s.json +23 -0
  62. zhhz-0.7.8/data/config/t2tw.json +24 -0
  63. zhhz-0.7.8/data/config/tw2s.json +32 -0
  64. zhhz-0.7.8/data/config/tw2sp.json +33 -0
  65. zhhz-0.7.8/data/config/tw2t.json +18 -0
  66. zhhz-0.7.8/data/dictionary/CJK_Compatibility_Ideographs.txt +2038 -0
  67. zhhz-0.7.8/data/dictionary/HKPhrases.txt +45 -0
  68. zhhz-0.7.8/data/dictionary/HKPhrasesRev.txt +42 -0
  69. zhhz-0.7.8/data/dictionary/HKVariants.txt +78 -0
  70. zhhz-0.7.8/data/dictionary/HKVariantsPhrases.txt +287 -0
  71. zhhz-0.7.8/data/dictionary/HKVariantsRevPhrases.txt +322 -0
  72. zhhz-0.7.8/data/dictionary/JPShinjitaiCharacters.txt +480 -0
  73. zhhz-0.7.8/data/dictionary/JPShinjitaiPhrases.txt +242 -0
  74. zhhz-0.7.8/data/dictionary/STCharacters.txt +4028 -0
  75. zhhz-0.7.8/data/dictionary/STPhrases.txt +49162 -0
  76. zhhz-0.7.8/data/dictionary/TSCharacters.txt +5057 -0
  77. zhhz-0.7.8/data/dictionary/TSPhrases.txt +476 -0
  78. zhhz-0.7.8/data/dictionary/TWPhrases.txt +784 -0
  79. zhhz-0.7.8/data/dictionary/TWPhrasesRev.txt +778 -0
  80. zhhz-0.7.8/data/dictionary/TWVariants.txt +47 -0
  81. zhhz-0.7.8/data/dictionary/TWVariantsPhrases.txt +21 -0
  82. zhhz-0.7.8/data/dictionary/TWVariantsRevPhrases.txt +1021 -0
  83. zhhz-0.7.8/data/dictionary_patches/STPhrases.multi-value.tsv +10 -0
  84. zhhz-0.7.8/data/scripts/common.py +191 -0
  85. zhhz-0.7.8/data/scripts/extract_tofu_risk.py +40 -0
  86. zhhz-0.7.8/data/scripts/generate_st_phrases_from_regional_phrases.py +172 -0
  87. zhhz-0.7.8/data/scripts/reverse.py +13 -0
  88. zhhz-0.7.8/deny.toml +38 -0
  89. zhhz-0.7.8/docs/_config.yml +19 -0
  90. zhhz-0.7.8/docs/_layouts/default.html +42 -0
  91. zhhz-0.7.8/docs/assets/css/style.css +241 -0
  92. zhhz-0.7.8/docs/benchmarks.md +72 -0
  93. zhhz-0.7.8/docs/cli.md +109 -0
  94. zhhz-0.7.8/docs/demo/index.html +159 -0
  95. zhhz-0.7.8/docs/demo/zhhz.js +703 -0
  96. zhhz-0.7.8/docs/demo/zhhz_bg.js +604 -0
  97. zhhz-0.7.8/docs/demo/zhhz_bg.wasm +0 -0
  98. zhhz-0.7.8/docs/faq.md +93 -0
  99. zhhz-0.7.8/docs/index.md +93 -0
  100. zhhz-0.7.8/docs/install.md +97 -0
  101. zhhz-0.7.8/docs/library.md +134 -0
  102. zhhz-0.7.8/docs/npm.md +200 -0
  103. zhhz-0.7.8/docs/python.md +173 -0
  104. zhhz-0.7.8/docs/why.md +52 -0
  105. zhhz-0.7.8/examples/bench.rs +97 -0
  106. zhhz-0.7.8/examples/bench_perf.rs +168 -0
  107. zhhz-0.7.8/examples/diff_corpus.rs +45 -0
  108. zhhz-0.7.8/examples/node-usage/.gitignore +3 -0
  109. zhhz-0.7.8/examples/node-usage/README.md +34 -0
  110. zhhz-0.7.8/examples/node-usage/index.mjs +104 -0
  111. zhhz-0.7.8/examples/node-usage/package.json +16 -0
  112. zhhz-0.7.8/examples/parity.rs +235 -0
  113. zhhz-0.7.8/examples/perf_anatomy.rs +65 -0
  114. zhhz-0.7.8/examples/perf_only.rs +78 -0
  115. zhhz-0.7.8/pyproject.toml +45 -0
  116. zhhz-0.7.8/python/zhhz/__init__.py +28 -0
  117. zhhz-0.7.8/python/zhhz/py.typed +1 -0
  118. zhhz-0.7.8/rust-toolchain.toml +9 -0
  119. zhhz-0.7.8/scripts/bench-baseline.sh +130 -0
  120. zhhz-0.7.8/scripts/benchmark.sh +138 -0
  121. zhhz-0.7.8/scripts/build-reference-opencc.sh +75 -0
  122. zhhz-0.7.8/scripts/sync-opencc.sh +102 -0
  123. zhhz-0.7.8/src/cli.rs +528 -0
  124. zhhz-0.7.8/src/config.rs +176 -0
  125. zhhz-0.7.8/src/data.rs +96 -0
  126. zhhz-0.7.8/src/detect.rs +601 -0
  127. zhhz-0.7.8/src/dict.rs +316 -0
  128. zhhz-0.7.8/src/engine.rs +897 -0
  129. zhhz-0.7.8/src/lib.rs +48 -0
  130. zhhz-0.7.8/src/main.rs +11 -0
  131. zhhz-0.7.8/src/ngram.rs +209 -0
  132. zhhz-0.7.8/src/python.rs +330 -0
  133. zhhz-0.7.8/src/wasm.rs +305 -0
  134. zhhz-0.7.8/tests/bench-node.mjs +89 -0
  135. zhhz-0.7.8/tests/context_cases.rs +190 -0
  136. zhhz-0.7.8/tests/convert.rs +62 -0
  137. zhhz-0.7.8/tests/wasm-smoke.mjs +118 -0
zhhz-0.7.8/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /target/
2
+ # Local wasm-pack build output (zhhz#40). pkg/ is the smoke-test
3
+ # nodejs-target build, pkg-npm/ is the bundler-target publish artifact.
4
+ pkg/
5
+ pkg-npm/
6
+ *.swp
7
+ *.swo
8
+ *~
9
+ .DS_Store
10
+ **/.release-artifacts/
11
+ .venv/
12
+ target/
@@ -0,0 +1,40 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in `zhhz`! This project follows the conventions of the
4
+ [`ljh-sh`](https://github.com/ljh-sh) Rust tools (`roff`, `fmeta`, `chardet`).
5
+
6
+ ## Development
7
+
8
+ ```bash
9
+ git clone https://github.com/ljh-sh/zhhz
10
+ cd zhhz
11
+ cargo test --all-features
12
+ cargo clippy --all-targets --all-features --locked -- -D warnings
13
+ cargo fmt -- --check
14
+ ```
15
+
16
+ The toolchain is pinned in `rust-toolchain.toml` (`stable-2024-11-28`) for
17
+ reproducible builds.
18
+
19
+ ## Adding / changing dictionaries
20
+
21
+ Dictionary data lives under `data/dictionary/` and `data/config/` and is a **pure
22
+ mirror** of [BYVoid/OpenCC](https://github.com/BYVoid/OpenCC). Do not hand-edit
23
+ these files. To pull the latest upstream data:
24
+
25
+ ```bash
26
+ scripts/sync-opencc.sh # master HEAD
27
+ scripts/sync-opencc.sh 1.3.1 # a tag or commit
28
+ ```
29
+
30
+ The five build-time-generated dictionaries (reversed variant tables, the
31
+ tofu-risk subset, the regional-phrase projection) are produced by `build.rs` from
32
+ the vendored source data — never commit generated files.
33
+
34
+ ## Pull requests
35
+
36
+ - Branch from `main` (`feat/...`, `fix/...`); keep linear history (squash or
37
+ rebase merges only).
38
+ - `cargo fmt`, `cargo clippy -D warnings`, and `cargo test` must pass.
39
+ - Conversion-correctness changes should include a test pinning the expected
40
+ output.
zhhz-0.7.8/Cargo.lock ADDED
@@ -0,0 +1,414 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "anyhow"
7
+ version = "1.0.103"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
10
+
11
+ [[package]]
12
+ name = "autocfg"
13
+ version = "1.5.1"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
16
+
17
+ [[package]]
18
+ name = "bitflags"
19
+ version = "2.13.0"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
22
+
23
+ [[package]]
24
+ name = "bumpalo"
25
+ version = "3.20.3"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
28
+
29
+ [[package]]
30
+ name = "cfg-if"
31
+ version = "1.0.4"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
34
+
35
+ [[package]]
36
+ name = "futures-core"
37
+ version = "0.3.32"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
40
+
41
+ [[package]]
42
+ name = "futures-task"
43
+ version = "0.3.32"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
46
+
47
+ [[package]]
48
+ name = "futures-util"
49
+ version = "0.3.32"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
52
+ dependencies = [
53
+ "futures-core",
54
+ "futures-task",
55
+ "pin-project-lite",
56
+ "slab",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "heck"
61
+ version = "0.4.1"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
64
+
65
+ [[package]]
66
+ name = "indoc"
67
+ version = "2.0.7"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
70
+ dependencies = [
71
+ "rustversion",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "itoa"
76
+ version = "1.0.18"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
79
+
80
+ [[package]]
81
+ name = "js-sys"
82
+ version = "0.3.103"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"
85
+ dependencies = [
86
+ "cfg-if",
87
+ "futures-util",
88
+ "wasm-bindgen",
89
+ ]
90
+
91
+ [[package]]
92
+ name = "libc"
93
+ version = "0.2.186"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
96
+
97
+ [[package]]
98
+ name = "lock_api"
99
+ version = "0.4.14"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
102
+ dependencies = [
103
+ "scopeguard",
104
+ ]
105
+
106
+ [[package]]
107
+ name = "memchr"
108
+ version = "2.8.2"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
111
+
112
+ [[package]]
113
+ name = "memoffset"
114
+ version = "0.9.1"
115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
116
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
117
+ dependencies = [
118
+ "autocfg",
119
+ ]
120
+
121
+ [[package]]
122
+ name = "once_cell"
123
+ version = "1.21.4"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
126
+
127
+ [[package]]
128
+ name = "parking_lot"
129
+ version = "0.12.5"
130
+ source = "registry+https://github.com/rust-lang/crates.io-index"
131
+ checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
132
+ dependencies = [
133
+ "lock_api",
134
+ "parking_lot_core",
135
+ ]
136
+
137
+ [[package]]
138
+ name = "parking_lot_core"
139
+ version = "0.9.12"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
142
+ dependencies = [
143
+ "cfg-if",
144
+ "libc",
145
+ "redox_syscall",
146
+ "smallvec",
147
+ "windows-link",
148
+ ]
149
+
150
+ [[package]]
151
+ name = "pin-project-lite"
152
+ version = "0.2.17"
153
+ source = "registry+https://github.com/rust-lang/crates.io-index"
154
+ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
155
+
156
+ [[package]]
157
+ name = "portable-atomic"
158
+ version = "1.13.1"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
161
+
162
+ [[package]]
163
+ name = "proc-macro2"
164
+ version = "1.0.106"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
167
+ dependencies = [
168
+ "unicode-ident",
169
+ ]
170
+
171
+ [[package]]
172
+ name = "pyo3"
173
+ version = "0.21.2"
174
+ source = "registry+https://github.com/rust-lang/crates.io-index"
175
+ checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
176
+ dependencies = [
177
+ "cfg-if",
178
+ "indoc",
179
+ "libc",
180
+ "memoffset",
181
+ "parking_lot",
182
+ "portable-atomic",
183
+ "pyo3-build-config",
184
+ "pyo3-ffi",
185
+ "pyo3-macros",
186
+ "unindent",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "pyo3-build-config"
191
+ version = "0.21.2"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
194
+ dependencies = [
195
+ "once_cell",
196
+ "target-lexicon",
197
+ ]
198
+
199
+ [[package]]
200
+ name = "pyo3-ffi"
201
+ version = "0.21.2"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
204
+ dependencies = [
205
+ "libc",
206
+ "pyo3-build-config",
207
+ ]
208
+
209
+ [[package]]
210
+ name = "pyo3-macros"
211
+ version = "0.21.2"
212
+ source = "registry+https://github.com/rust-lang/crates.io-index"
213
+ checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
214
+ dependencies = [
215
+ "proc-macro2",
216
+ "pyo3-macros-backend",
217
+ "quote",
218
+ "syn",
219
+ ]
220
+
221
+ [[package]]
222
+ name = "pyo3-macros-backend"
223
+ version = "0.21.2"
224
+ source = "registry+https://github.com/rust-lang/crates.io-index"
225
+ checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
226
+ dependencies = [
227
+ "heck",
228
+ "proc-macro2",
229
+ "pyo3-build-config",
230
+ "quote",
231
+ "syn",
232
+ ]
233
+
234
+ [[package]]
235
+ name = "quote"
236
+ version = "1.0.46"
237
+ source = "registry+https://github.com/rust-lang/crates.io-index"
238
+ checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
239
+ dependencies = [
240
+ "proc-macro2",
241
+ ]
242
+
243
+ [[package]]
244
+ name = "redox_syscall"
245
+ version = "0.5.18"
246
+ source = "registry+https://github.com/rust-lang/crates.io-index"
247
+ checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
248
+ dependencies = [
249
+ "bitflags",
250
+ ]
251
+
252
+ [[package]]
253
+ name = "rustversion"
254
+ version = "1.0.22"
255
+ source = "registry+https://github.com/rust-lang/crates.io-index"
256
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
257
+
258
+ [[package]]
259
+ name = "scopeguard"
260
+ version = "1.2.0"
261
+ source = "registry+https://github.com/rust-lang/crates.io-index"
262
+ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
263
+
264
+ [[package]]
265
+ name = "serde"
266
+ version = "1.0.228"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
269
+ dependencies = [
270
+ "serde_core",
271
+ ]
272
+
273
+ [[package]]
274
+ name = "serde_core"
275
+ version = "1.0.228"
276
+ source = "registry+https://github.com/rust-lang/crates.io-index"
277
+ checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
278
+ dependencies = [
279
+ "serde_derive",
280
+ ]
281
+
282
+ [[package]]
283
+ name = "serde_derive"
284
+ version = "1.0.228"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
287
+ dependencies = [
288
+ "proc-macro2",
289
+ "quote",
290
+ "syn",
291
+ ]
292
+
293
+ [[package]]
294
+ name = "serde_json"
295
+ version = "1.0.150"
296
+ source = "registry+https://github.com/rust-lang/crates.io-index"
297
+ checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
298
+ dependencies = [
299
+ "itoa",
300
+ "memchr",
301
+ "serde",
302
+ "serde_core",
303
+ "zmij",
304
+ ]
305
+
306
+ [[package]]
307
+ name = "slab"
308
+ version = "0.4.12"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
311
+
312
+ [[package]]
313
+ name = "smallvec"
314
+ version = "1.15.2"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
317
+
318
+ [[package]]
319
+ name = "syn"
320
+ version = "2.0.118"
321
+ source = "registry+https://github.com/rust-lang/crates.io-index"
322
+ checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
323
+ dependencies = [
324
+ "proc-macro2",
325
+ "quote",
326
+ "unicode-ident",
327
+ ]
328
+
329
+ [[package]]
330
+ name = "target-lexicon"
331
+ version = "0.12.16"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
334
+
335
+ [[package]]
336
+ name = "unicode-ident"
337
+ version = "1.0.24"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
340
+
341
+ [[package]]
342
+ name = "unindent"
343
+ version = "0.2.4"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
346
+
347
+ [[package]]
348
+ name = "wasm-bindgen"
349
+ version = "0.2.126"
350
+ source = "registry+https://github.com/rust-lang/crates.io-index"
351
+ checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"
352
+ dependencies = [
353
+ "cfg-if",
354
+ "once_cell",
355
+ "rustversion",
356
+ "wasm-bindgen-macro",
357
+ "wasm-bindgen-shared",
358
+ ]
359
+
360
+ [[package]]
361
+ name = "wasm-bindgen-macro"
362
+ version = "0.2.126"
363
+ source = "registry+https://github.com/rust-lang/crates.io-index"
364
+ checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"
365
+ dependencies = [
366
+ "quote",
367
+ "wasm-bindgen-macro-support",
368
+ ]
369
+
370
+ [[package]]
371
+ name = "wasm-bindgen-macro-support"
372
+ version = "0.2.126"
373
+ source = "registry+https://github.com/rust-lang/crates.io-index"
374
+ checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"
375
+ dependencies = [
376
+ "bumpalo",
377
+ "proc-macro2",
378
+ "quote",
379
+ "syn",
380
+ "wasm-bindgen-shared",
381
+ ]
382
+
383
+ [[package]]
384
+ name = "wasm-bindgen-shared"
385
+ version = "0.2.126"
386
+ source = "registry+https://github.com/rust-lang/crates.io-index"
387
+ checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"
388
+ dependencies = [
389
+ "unicode-ident",
390
+ ]
391
+
392
+ [[package]]
393
+ name = "windows-link"
394
+ version = "0.2.1"
395
+ source = "registry+https://github.com/rust-lang/crates.io-index"
396
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
397
+
398
+ [[package]]
399
+ name = "zhhz"
400
+ version = "0.7.8"
401
+ dependencies = [
402
+ "anyhow",
403
+ "js-sys",
404
+ "memchr",
405
+ "pyo3",
406
+ "serde_json",
407
+ "wasm-bindgen",
408
+ ]
409
+
410
+ [[package]]
411
+ name = "zmij"
412
+ version = "1.0.21"
413
+ source = "registry+https://github.com/rust-lang/crates.io-index"
414
+ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
zhhz-0.7.8/Cargo.toml ADDED
@@ -0,0 +1,75 @@
1
+ [package]
2
+ name = "zhhz"
3
+ version = "0.7.8"
4
+ authors = ["ljh-sh <lijunhao@x-cmd.com>"]
5
+ edition = "2021"
6
+ rust-version = "1.74"
7
+ description = "Self-contained, static-build Simplified/Traditional Chinese converter — a pure-Rust, data-embedded reimplementation of OpenCC"
8
+ readme = "README.md"
9
+ homepage = "https://github.com/ljh-sh/zhhz"
10
+ documentation = "https://github.com/ljh-sh/zhhz"
11
+ license = "Apache-2.0"
12
+ repository = "https://github.com/ljh-sh/zhhz"
13
+ keywords = ["chinese", "opencc", "simplified", "traditional", "conversion"]
14
+ categories = ["text-processing", "internationalization", "command-line-utilities"]
15
+ exclude = [
16
+ ".release-artifacts/",
17
+ ".github/",
18
+ ".x-cmd/",
19
+ "target/",
20
+ "*.swp",
21
+ "*.swo",
22
+ "*~",
23
+ ".DS_Store",
24
+ ]
25
+
26
+ [lib]
27
+ name = "zhhz"
28
+ path = "src/lib.rs"
29
+ # Both `cdylib` (for the `wasm32-unknown-unknown` build via the `wasm`
30
+ # feature) and `rlib` (for the native CLI + Rust consumers). The native
31
+ # release only ships the CLI binary, not the cdylib.
32
+ crate-type = ["cdylib", "rlib"]
33
+
34
+ [[bin]]
35
+ name = "zhhz"
36
+ path = "src/main.rs"
37
+
38
+ [dependencies]
39
+ anyhow = "1"
40
+ # Only serde_json for config parsing. The CLI arg parser is hand-rolled
41
+ # (src/cli.rs) to keep the dependency tree tiny and the static binary small.
42
+ serde_json = "1"
43
+ # WebAssembly bindings (only pulled in with --features wasm).
44
+ wasm-bindgen = { version = "0.2", optional = true }
45
+ js-sys = { version = "0.3", optional = true }
46
+ memchr = "2.8.2"
47
+
48
+ # CPython extension module via PyO3 (only pulled in with --features python).
49
+ # Building this needs Python 3.9+ headers on the build machine; maturin
50
+ # handles cross-platform wheel builds (manylinux / musllinux / macOS /
51
+ # Windows) in CI.
52
+ pyo3 = { version = "0.21", features = ["extension-module"], optional = true }
53
+
54
+ [features]
55
+ # Build the WebAssembly bindings (used by `cargo build --target
56
+ # wasm32-unknown-unknown --features wasm`).
57
+ wasm = ["dep:wasm-bindgen", "dep:js-sys"]
58
+
59
+ # Build the CPython extension module via PyO3. Builds a single rlib +
60
+ # cdylib for the maturin build process; the native CLI / library still
61
+ # works without this feature.
62
+ python = ["dep:pyo3"]
63
+
64
+ # Small, fully-static release binary. The OpenCC data (~1.3 MiB of UTF-8 text)
65
+ # is embedded via include_str!, so the binary is self-contained.
66
+ [profile.release]
67
+ lto = true
68
+ codegen-units = 1
69
+ strip = true
70
+ panic = "abort"
71
+
72
+ # Tests need unwind (the default) so `cargo test` can build with
73
+ # dependencies that require `unwind` panic strategy.
74
+ [profile.test]
75
+ panic = "unwind"