{"id":13417842,"url":"https://github.com/BYVoid/OpenCC","last_synced_at":"2025-03-15T02:31:51.763Z","repository":{"id":37990793,"uuid":"776621","full_name":"BYVoid/OpenCC","owner":"BYVoid","description":"Conversion between Traditional and Simplified Chinese","archived":false,"fork":false,"pushed_at":"2024-09-26T20:58:40.000Z","size":11545,"stargazers_count":8430,"open_issues_count":195,"forks_count":977,"subscribers_count":208,"default_branch":"master","last_synced_at":"2024-10-14T20:22:03.975Z","etag":null,"topics":["chinese-translation","simplified-chinese","traditional-chinese"],"latest_commit_sha":null,"homepage":"https://opencc.byvoid.com/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BYVoid.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"BYVoid"}},"created_at":"2010-07-15T13:02:03.000Z","updated_at":"2024-10-14T09:19:47.000Z","dependencies_parsed_at":"2024-06-18T12:19:33.805Z","dependency_job_id":"e61439ec-4e4d-4bdf-8a8a-63be1db89622","html_url":"https://github.com/BYVoid/OpenCC","commit_stats":{"total_commits":1192,"total_committers":111,"mean_commits":10.73873873873874,"dds":0.6937919463087248,"last_synced_commit":"e5d6c5f1b78e28a5797e7ad3ede3513314e544b7"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BYVoid%2FOpenCC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BYVoid%2FOpenCC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BYVoid%2FOpenCC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BYVoid%2FOpenCC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BYVoid","download_url":"https://codeload.github.com/BYVoid/OpenCC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221532157,"owners_count":16838905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese-translation","simplified-chinese","traditional-chinese"],"created_at":"2024-07-30T22:00:53.759Z","updated_at":"2025-03-15T02:31:51.756Z","avatar_url":"https://github.com/BYVoid.png","language":"C++","funding_links":["https://github.com/sponsors/BYVoid"],"categories":["TODO scan for Android support in followings","HarmonyOS","C++","Uncategorized","效率 \u003ca name=\"good\"\u003e\u003c/a\u003e","Tools"],"sub_categories":["Windows Manager","Uncategorized"],"readme":"# Open Chinese Convert 開放中文轉換\n\n[![CMake](https://github.com/BYVoid/OpenCC/actions/workflows/cmake.yml/badge.svg)](https://github.com/BYVoid/OpenCC/actions/workflows/cmake.yml)\n[![Bazel](https://github.com/BYVoid/OpenCC/actions/workflows/bazel.yml/badge.svg)](https://github.com/BYVoid/OpenCC/actions/workflows/bazel.yml)\n[![MSVC](https://github.com/BYVoid/OpenCC/actions/workflows/msvc.yml/badge.svg)](https://github.com/BYVoid/OpenCC/actions/workflows/msvc.yml)\n[![Node.js CI](https://github.com/BYVoid/OpenCC/actions/workflows/nodejs.yml/badge.svg)](https://github.com/BYVoid/OpenCC/actions/workflows/nodejs.yml)\n[![Python CI](https://github.com/BYVoid/OpenCC/actions/workflows/python.yml/badge.svg)](https://github.com/BYVoid/OpenCC/actions/workflows/python.yml)\n[![AppVeyor](https://img.shields.io/appveyor/ci/Carbo/OpenCC.svg)](https://ci.appveyor.com/project/Carbo/OpenCC)\n\n## Introduction 介紹\n\n![OpenCC](https://opencc.byvoid.com/img/opencc.png)\n\nOpen Chinese Convert (OpenCC, 開放中文轉換) is an opensource project for conversions between Traditional Chinese, Simplified Chinese and Japanese Kanji (Shinjitai). It supports character-level and phrase-level conversion, character variant conversion and regional idioms among Mainland China, Taiwan and Hong Kong. This is not translation tool between Mandarin and Cantonese, etc.\n\n中文簡繁轉換開源項目，支持詞彙級別的轉換、異體字轉換和地區習慣用詞轉換（中國大陸、臺灣、香港、日本新字體）。不提供普通話與粵語的轉換。\n\nDiscussion (Telegram): https://t.me/open_chinese_convert\n\n### Features 特點\n\n* 嚴格區分「一簡對多繁」和「一簡對多異」。\n* 完全兼容異體字，可以實現動態替換。\n* 嚴格審校一簡對多繁詞條，原則爲「能分則不合」。\n* 支持中國大陸、臺灣、香港異體字和地區習慣用詞轉換，如「裏」「裡」、「鼠標」「滑鼠」。\n* 詞庫和函數庫完全分離，可以自由修改、導入、擴展。\n\n## Installation 安裝\n\n### Package Managers 包管理器\n\n* [Debian](https://tracker.debian.org/pkg/opencc)\n* [Ubuntu](https://launchpad.net/ubuntu/+source/opencc)\n* [Fedora](https://packages.fedoraproject.org/pkgs/opencc/opencc/)\n* [Arch Linux](https://archlinux.org/packages/extra/x86_64/opencc/)\n* [Mac](https://formulae.brew.sh/formula/opencc)\n* [Bazel](https://registry.bazel.build/modules/opencc)\n* [Node.js](https://npmjs.org/package/opencc)\n* [Python](https://pypi.org/project/OpenCC/)\n\n### Prebuilt 預編譯\n\n* Windows (x86_64): [Latest build](https://ci.appveyor.com/api/projects/Carbo/opencc/artifacts/OpenCC.zip?branch=master\u0026job=Environment:%20nodejs_version=none;%20Platform:%20x64)\n* Windows (x86): [Latest build](https://ci.appveyor.com/api/projects/Carbo/opencc/artifacts/OpenCC.zip?branch=master\u0026job=Environment:%20nodejs_version=none;%20Platform:%20x86)\n\n## Usage 使用\n\n### Online demo 線上轉換展示\n\nWarning: **This is NOT an API.** You will be banned if you make calls programmatically.\n\nhttps://opencc.byvoid.com/\n\n### Node.js\n\n[npm](https://www.npmjs.com/opencc) `npm install opencc`\n\n#### JavaScript\n```js\nconst OpenCC = require('opencc');\nconst converter = new OpenCC('s2t.json');\nconverter.convertPromise(\"汉字\").then(converted =\u003e {\n  console.log(converted);  // 漢字\n});\n```\n\n#### TypeScript\n```ts\nimport { OpenCC } from 'opencc';\nasync function main() {\n  const converter: OpenCC = new OpenCC('s2t.json');\n  const result: string = await converter.convertPromise('汉字');\n  console.log(result);\n}\n```\n\nSee [demo.js](https://github.com/BYVoid/OpenCC/blob/master/node/demo.js) and [ts-demo.ts](https://github.com/BYVoid/OpenCC/blob/master/node/ts-demo.ts).\n\n### Python\n\n`pip install opencc` (Windows, Linux, Mac)\n\n```python\nimport opencc\nconverter = opencc.OpenCC('s2t.json')\nconverter.convert('汉字')  # 漢字\n```\n\n### C++\n\n```c++\n#include \"opencc.h\"\n\nint main() {\n  const opencc::SimpleConverter converter(\"s2t.json\");\n  converter.Convert(\"汉字\");  // 漢字\n  return 0;\n}\n```\n\n[Full example with Bazel](https://github.com/BYVoid/opencc-bazel-example)\n\n### C\n\n```c\n#include \"opencc.h\"\n\nint main() {\n  opencc_t opencc = opencc_open(\"s2t.json\");\n  const char* input = \"汉字\";\n  char* converted = opencc_convert_utf8(opencc, input, strlen(input));  // 漢字\n  opencc_convert_utf8_free(converted);\n  opencc_close(opencc);\n  return 0;\n}\n\n```\n\nDocument 文檔: https://byvoid.github.io/OpenCC/\n\n### Command Line\n\n* `opencc --help`\n* `opencc_dict --help`\n* `opencc_phrase_extract --help`\n\n### Others (Unofficial)\n\n* Swift (iOS): [SwiftyOpenCC](https://github.com/XQS6LB3A/SwiftyOpenCC)\n* iOSOpenCC (pod): [iOSOpenCC](https://github.com/swiftdo/OpenCC)\n* Java: [opencc4j](https://github.com/houbb/opencc4j)\n* Android: [android-opencc](https://github.com/qichuan/android-opencc)\n* PHP: [opencc4php](https://github.com/nauxliu/opencc4php)\n* Pure JavaScript: [opencc-js](https://github.com/nk2028/opencc-js)\n* WebAssembly: [wasm-opencc](https://github.com/oyyd/wasm-opencc)\n* Browser Extension: [opencc-extension](https://github.com/tnychn/opencc-extension)\n* Go (Pure): [OpenCC for Go](https://github.com/longbridge/opencc)\n* Dart (native-assets): [opencc-dart](https://github.com/lindeer/opencc-dart)\n\n### Configurations 配置文件\n\n#### 預設配置文件\n\n* `s2t.json` Simplified Chinese to Traditional Chinese 簡體到繁體\n* `t2s.json` Traditional Chinese to Simplified Chinese 繁體到簡體\n* `s2tw.json` Simplified Chinese to Traditional Chinese (Taiwan Standard) 簡體到臺灣正體\n* `tw2s.json` Traditional Chinese (Taiwan Standard) to Simplified Chinese 臺灣正體到簡體\n* `s2hk.json` Simplified Chinese to Traditional Chinese (Hong Kong variant) 簡體到香港繁體\n* `hk2s.json` Traditional Chinese (Hong Kong variant) to Simplified Chinese 香港繁體到簡體\n* `s2twp.json` Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom 簡體到繁體（臺灣正體標準）並轉換爲臺灣常用詞彙\n* `tw2sp.json` Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom 繁體（臺灣正體標準）到簡體並轉換爲中國大陸常用詞彙\n* `t2tw.json` Traditional Chinese (OpenCC Standard) to Taiwan Standard 繁體（OpenCC 標準）到臺灣正體\n* `hk2t.json` Traditional Chinese (Hong Kong variant) to Traditional Chinese 香港繁體到繁體（OpenCC 標準）\n* `t2hk.json` Traditional Chinese (OpenCC Standard) to Hong Kong variant 繁體（OpenCC 標準）到香港繁體\n* `t2jp.json` Traditional Chinese Characters (Kyūjitai) to New Japanese Kanji (Shinjitai) 繁體（OpenCC 標準，舊字體）到日文新字體\n* `jp2t.json` New Japanese Kanji (Shinjitai) to Traditional Chinese Characters (Kyūjitai) 日文新字體到繁體（OpenCC 標準，舊字體）\n* `tw2t.json` Traditional Chinese (Taiwan standard) to Traditional Chinese 臺灣正體到繁體（OpenCC 標準）\n\n## Build 編譯\n\n### Build with CMake\n\n#### Linux \u0026 Mac OS X\n\ng++ 4.6+ or clang 3.2+ is required.\n\n```bash\nmake\n```\n\n#### Windows Visual Studio:\n\n```bash\nbuild.cmd\n```\n\n### Build with Bazel\n\n```bash\nbazel build //:opencc\nbazel test --test_output=all //src/... //data/... //test/...\n```\n\n### Test 測試\n\n#### Linux \u0026 Mac OS X\n\n```\nmake test\n```\n\n#### Windows Visual Studio:\n\n```bash\ntest.cmd\n```\n\n### Benchmark 基準測試\n\n```\nmake benchmark\n```\n\nExample results (from Github CI):\n\n```\n1: ------------------------------------------------------------------\n1: Benchmark                        Time             CPU   Iterations\n1: ------------------------------------------------------------------\n1: BM_Initialization/hk2s        1.56 ms         1.56 ms          442\n1: BM_Initialization/hk2t       0.144 ms        0.144 ms         4878\n1: BM_Initialization/jp2t       0.260 ms        0.260 ms         2604\n1: BM_Initialization/s2hk        23.8 ms         23.8 ms           29\n1: BM_Initialization/s2t         25.6 ms         25.6 ms           28\n1: BM_Initialization/s2tw        24.0 ms         23.9 ms           30\n1: BM_Initialization/s2twp       24.6 ms         24.6 ms           28\n1: BM_Initialization/t2hk       0.052 ms        0.052 ms        12897\n1: BM_Initialization/t2jp       0.141 ms        0.141 ms         5012\n1: BM_Initialization/t2s         1.30 ms         1.30 ms          540\n1: BM_Initialization/tw2s        1.39 ms         1.39 ms          529\n1: BM_Initialization/tw2sp       1.69 ms         1.69 ms          426\n1: BM_Initialization/tw2t       0.089 ms        0.089 ms         7707\n1: BM_Convert2M                   582 ms          582 ms            1\n1: BM_Convert/100                1.07 ms         1.07 ms          636\n1: BM_Convert/1000               11.0 ms         11.0 ms           67\n1: BM_Convert/10000               113 ms          113 ms            6\n1: BM_Convert/100000             1176 ms         1176 ms            1\n```\n\n## Projects using OpenCC 使用 OpenCC 的項目\n\nPlease update if your project is using OpenCC.\n\n* [ibus-pinyin](https://github.com/ibus/ibus-pinyin)\n* [fcitx](https://github.com/fcitx/fcitx)\n* [rimeime](https://rime.im/)\n* [libgooglepinyin](http://code.google.com/p/libgooglepinyin/)\n* [ibus-libpinyin](https://github.com/libpinyin/ibus-libpinyin)\n* [alfred-chinese-converter](https://github.com/amowu/alfred-chinese-converter)\n* [GoldenDict](https://github.com/goldendict/goldendict)\n\n## License 許可協議\n\nApache License 2.0\n\n## Third Party Library 第三方庫\n\n* [darts-clone](https://github.com/s-yata/darts-clone) BSD License\n* [marisa-trie](https://github.com/s-yata/marisa-trie) BSD License\n* [tclap](http://tclap.sourceforge.net/) MIT License\n* [rapidjson](https://github.com/Tencent/rapidjson) MIT License\n* [Google Test](https://github.com/google/googletest) BSD License\n\nAll these libraries are statically linked by default.\n\n## Change History 版本歷史\n\n* [NEWS](https://github.com/BYVoid/OpenCC/blob/master/NEWS.md)\n\n### Links 相關鏈接\n\n* Introduction 詳細介紹 https://github.com/BYVoid/OpenCC/wiki/%E7%B7%A3%E7%94%B1\n* 現代漢語常用簡繁一對多字義辨析表 http://ytenx.org/byohlyuk/KienxPyan\n\n## Contributors 貢獻者\n\n* [BYVoid](http://www.byvoid.com/)\n* [佛振](https://github.com/lotem)\n* [Peng Huang](https://github.com/phuang)\n* [LI Daobing](https://github.com/lidaobing)\n* [Kefu Chai](https://github.com/tchaikov)\n* [Kan-Ru Chen](http://kanru.info/)\n* [Ma Xiaojun](https://twitter.com/damage3025)\n* [Jiang Jiang](http://jjgod.org/)\n* [Ruey-Cheng Chen](https://github.com/rueycheng)\n* [Paul Meng](http://home.mno2.org/)\n* [Lawrence Lau](https://github.com/ktslwy)\n* [瑾昀](https://github.com/kunki)\n* [內木一郎](https://github.com/SyaoranHinata)\n* [Marguerite Su](https://www.marguerite.su/)\n* [Brian White](http://mscdex.net)\n* [Qijiang Fan](https://fqj.me/)\n* [LEOYoon-Tsaw](https://github.com/LEOYoon-Tsaw)\n* [Steven Yao](https://github.com/stevenyao)\n* [Pellaeon Lin](https://github.com/pellaeon)\n* [stony](https://github.com/stony-shixz)\n* [steelywing](https://github.com/steelywing)\n* [吕旭东](https://github.com/lvxudong)\n* [Weng Xuetian](https://github.com/wengxt)\n* [Ma Tao](https://github.com/iwater)\n* [Heinz Wiesinger](https://github.com/pprkut)\n* [J.W](https://github.com/jakwings)\n* [Amo Wu](https://github.com/amowu)\n* [Mark Tsai](https://github.com/mxgit1090)\n* [Zhe Wang](https://github.com/0x1997)\n* [sgqy](https://github.com/sgqy)\n* [Qichuan (Sean) ZHANG](https://github.com/qichuan)\n* [Flandre Scarlet](https://github.com/XadillaX)\n* [宋辰文](https://github.com/songchenwen)\n* [iwater](https://github.com/iwater)\n* [Xpol Wan](https://github.com/xpol)\n* [Weihang Lo](https://github.com/weihanglo)\n* [Cychih](https://github.com/pi314)\n* [kyleskimo](https://github.com/kyleskimo)\n* [Ryuan Choi](https://github.com/bunhere)\n* [Prcuvu](https://github.com/Prcuvu)\n* [Tony Able](https://github.com/TonyAble)\n* [Xiao Liang](https://github.com/yxliang01)\n\nPlease feel free to update this list if you have contributed OpenCC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBYVoid%2FOpenCC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBYVoid%2FOpenCC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBYVoid%2FOpenCC/lists"}