Skip to content

Commit 931b67a

Browse files
committed
docs: keep usage guidance version-agnostic
Also add Traditional Chinese README
1 parent 52f599f commit 931b67a

2 files changed

Lines changed: 29 additions & 40 deletions

File tree

README.md

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,22 @@
11
# opencc-data [![](https://badge.fury.io/js/opencc-data.svg)](https://www.npmjs.com/package/opencc-data) [![JSDelivr badge](https://data.jsdelivr.com/v1/package/npm/opencc-data/badge)](https://www.jsdelivr.com/package/npm/opencc-data)
22

3-
A collection of word lists for Simplified and Traditional Chinese conversions from the [OpenCC](https://github.com/BYVoid/OpenCC) project.
3+
[繁體中文](README.zh-TW.md)
4+
5+
A collection of dictionary data, configs, and test data for Simplified and Traditional Chinese conversions from the [OpenCC](https://github.com/BYVoid/OpenCC) project.
46

57
## Compatibility
68

7-
This project is primarily maintained for use with [opencc-js](https://github.com/nk2028/opencc-js).
9+
This package is intended for [opencc-js](https://github.com/nk2028/opencc-js) and other OpenCC-compatible implementations that consume OpenCC dictionary and config data.
810

911
- **Strict Version Matching**: Compatibility is only guaranteed when the version of `opencc-data` strictly matches the version of the consumer package.
1012
- **Breaking Changes**: We do not guarantee compatibility between different versions of `opencc-data`. Structure or file names may change to align with upstream OpenCC updates.
1113

1214
## Data Sync Policy
1315

14-
This package syncs upstream OpenCC dictionary `.txt` files, config `.json` files, and `test/testcases/testcases.json`. It also generates and checks in derived dictionaries during data sync: `TSCharactersExt.txt` from `TSCharacters.txt`, plus the reverse variant dictionaries `HKVariantsRev.txt`, `TWVariantsRev.txt`, and `JPVariantsRev.txt` from their corresponding variant dictionaries.
16+
This package syncs dictionary `.txt` files and config `.json` files from OpenCC's generated resource zip, plus `test/testcases/testcases.json` from the upstream repository. Each sync keeps the upstream resource manifest as an internal baseline so future updates can detect substantive data changes by resource hash.
1517

1618
## Usage
1719

18-
The data files prioritize canonical data from the OpenCC project. The following configurations are strictly consistent with the logic in OpenCC's `.json` configuration files:
19-
20-
- **Outer Array (Stages)**: Represents the conversion-chain stages.
21-
- **Inner Array (Groups)**: Represents a dictionary group used within one stage; dictionaries earlier in the group have higher priority when their entries overlap (merged relationship).
22-
23-
**From Chinese variants to OpenCC standard:**
24-
25-
```json
26-
{
27-
"cn": [["STPhrases", "STCharacters"]],
28-
"hk": [["HKVariantsRevPhrases", "HKVariantsRev"]],
29-
"tw": [["TWVariantsRevPhrases", "TWVariantsRev"]],
30-
"twp": [["TWPhrasesRev", "TWVariantsRevPhrases", "TWVariantsRev"]],
31-
"jp": [["JPShinjitaiPhrases", "JPShinjitaiCharacters", "JPVariantsRev"]]
32-
}
33-
```
34-
35-
**From OpenCC standard to Chinese variants:**
36-
37-
```json
38-
{
39-
"cn": [["TSPhrases", "TSCharactersExt", "TSCharacters"]],
40-
"hk": [["HKVariantsPhrases", "HKVariants"]],
41-
"tw": [["TWVariantsPhrases", "TWVariants"]],
42-
"twp": [["TWPhrases"], ["TWVariantsPhrases", "TWVariants"]],
43-
"jp": [["JPVariants"]]
44-
}
45-
```
46-
47-
`TSCharactersExt` contains rare inferred simplified forms that may render as tofu (missing glyph boxes) in common fonts. It should generally be omitted unless those extended mappings are explicitly required.
48-
49-
**Explanation of the Chinese variants above:**
20+
Use the config files shipped in `data/config/` as the source of truth for dictionary order and conversion-chain behavior. Config contents can change between OpenCC versions, so consumers should load the matching config file for the package version they depend on instead of hard-coding dictionary lists from this README.
5021

51-
- `cn`: Simplified Chinese (Mainland China)
52-
- `tw`: Traditional Chinese (Taiwan)
53-
- `twp`: Traditional Chinese (Taiwan, with phrase conversion)
54-
- `hk`: Traditional Chinese (Hong Kong)
55-
- `jp`: Japanese Shinjitai
22+
Dictionary text files are shipped in `data/`. Config files reference those dictionaries by file name and preserve OpenCC's stage/group ordering semantics.

README.zh-TW.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# opencc-data [![](https://badge.fury.io/js/opencc-data.svg)](https://www.npmjs.com/package/opencc-data) [![JSDelivr badge](https://data.jsdelivr.com/v1/package/npm/opencc-data/badge)](https://www.jsdelivr.com/package/npm/opencc-data)
2+
3+
[English](README.md)
4+
5+
本套件收錄來自 [OpenCC](https://github.com/BYVoid/OpenCC) 專案的簡繁轉換詞典資料、配置與測試集。
6+
7+
## 相容性
8+
9+
本套件適用於 [opencc-js](https://github.com/nk2028/opencc-js),也可供其他相容 OpenCC 詞典與設定檔格式的實作使用。
10+
11+
- **嚴格版本匹配**:只有在 `opencc-data` 與使用端套件版本完全一致時,才保證相容性。
12+
- **破壞性變更**:不同版本的 `opencc-data` 之間不保證相容。資料結構或檔名可能會隨上游 OpenCC 更新而調整。
13+
14+
## 資料同步政策
15+
16+
本套件會從 OpenCC 產生的 resource zip 同步詞典 `.txt` 檔與設定 `.json` 檔,並從上游 repository 同步 `test/testcases/testcases.json`。每次同步都會保留上游 resource manifest 作為內部基準,之後可透過 resource hash 判斷是否有實質資料變更。
17+
18+
## 使用方式
19+
20+
請以套件內 `data/config/` 提供的設定檔作為詞典順序與轉換鏈行為的依據。設定內容可能隨 OpenCC 版本改變,因此使用端應載入其依賴版本對應的設定檔,而不是從 README 固定寫死詞典列表。
21+
22+
詞典文字檔位於 `data/`。設定檔會以檔名引用這些詞典,並保留 OpenCC 的 stage/group 排序語意。

0 commit comments

Comments
 (0)