{"id":15646012,"url":"https://github.com/liuyueyi/quick-chinese-transfer","last_synced_at":"2026-03-16T21:04:23.797Z","repository":{"id":55837267,"uuid":"315303956","full_name":"liuyueyi/quick-chinese-transfer","owner":"liuyueyi","description":"简繁转换，支持香港繁体，台湾繁体与简体互转","archived":false,"fork":false,"pushed_at":"2025-03-04T06:13:35.000Z","size":17105,"stargazers_count":66,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T23:07:25.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuyueyi.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-23T12:11:17.000Z","updated_at":"2025-03-11T03:27:21.000Z","dependencies_parsed_at":"2024-10-21T19:02:32.154Z","dependency_job_id":null,"html_url":"https://github.com/liuyueyi/quick-chinese-transfer","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"cf24ac21500b9cbb4092eedd28a34a667f02dd42"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyueyi%2Fquick-chinese-transfer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyueyi%2Fquick-chinese-transfer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyueyi%2Fquick-chinese-transfer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyueyi%2Fquick-chinese-transfer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuyueyi","download_url":"https://codeload.github.com/liuyueyi/quick-chinese-transfer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246927839,"owners_count":20856198,"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":[],"created_at":"2024-10-03T12:10:59.424Z","updated_at":"2026-03-16T21:04:23.792Z","avatar_url":"https://github.com/liuyueyi.png","language":"Java","funding_links":[],"categories":["人工智能"],"sub_categories":["自然语言处理"],"readme":"# quick-chinese-transfer\n\n[![Builder](https://travis-ci.org/liuyueyi/quick-chinese-transfer.svg?branch=master)](https://travis-ci.org/liuyueyi/quick-chinese-transfer)\n[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.github.liuyueyi/quick-transfer-core.svg)](https://search.maven.org/search?q=a:quick-transfer-core)\n[![JitPack](https://jitpack.io/v/liuyueyi/quick-chinese-transfer.svg)](https://jitpack.io/#liuyueyi/quick-chinese-transfer)\n[![codecov](https://codecov.io/gh/liuyueyi/quick-chinese-transfer/branch/master/graph/badge.svg)](https://codecov.io/gh/liuyueyi/quick-chinese-transfer)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/liuyueyi/quick-chinese-transfer.svg)](http://isitmaintained.com/project/liuyueyi/quick-chinese-transfer \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/liuyueyi/quick-chinese-transfer.svg)](http://isitmaintained.com/project/liuyueyi/quick-chinese-transfer \"Percentage of issues still open\")\n\n两个插件:\n\n- [简繁转换](transfer-core)\n- [汉字笔画](hanzi-writer)\n\n## 简繁转换 (transfer-core)\n\n简体中文，繁体中文，香港繁体，台湾繁体 相互转换的Java库\n\n本项目主要来自于\n\n- [https://github.com/hankcs/HanLP](https://github.com/hankcs/HanLP)\n- [https://github.com/luhuiguo/chinese-utils](https://github.com/luhuiguo/chinese-utils)\n\n词典更新维护来自：\n\n- [https://github.com/hankcs/HanLP/tree/1.x/data/dictionary/tc](https://github.com/hankcs/HanLP/tree/1.x/data/dictionary/tc)\n\n### 使用姿势\n\n**maven依赖**\n\n中央仓库导入依赖\n\n```xml\n\u003c!-- https://mvnrepository.com/artifact/com.github.liuyueyi/quick-transfer-core --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.liuyueyi\u003c/groupId\u003e\n    \u003cartifactId\u003equick-transfer-core\u003c/artifactId\u003e\n    \u003cversion\u003e0.2.17\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**中央仓库 gradle**\n\n```gradle\n// https://mvnrepository.com/artifact/com.github.liuyueyi/quick-transfer-core\nimplementation 'com.github.liuyueyi:quick-transfer-core:0.2.17'\n```\n\n**使用jitpack导入依赖**\n\n```xml\n\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.liuyueyi.quick-chinese-transfer\u003c/groupId\u003e\n  \u003cartifactId\u003equick-transfer-core\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.17\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**gradle依赖**\n\n```gradle\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n\ndependencies {\n    implementation 'com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.17'\n}\n```\n\n**基本使用演示**\n\n```java\npublic void testTrans() {\n    String text = \"这斜月三星洞…… 长寿面，孙悟空，猪八戒，唐僧，沙和尚，白龙马，李靖，托塔天王, 戏说西游，许多人都这样说，收拾一下，拾金不昧；纔=才\";\n    String out = ChineseUtils.s2t(text);\n    System.out.println(\"s2t --\u003e\" + out);\n    String hkOut = ChineseUtils.s2hk(text);\n    System.out.println(\"s2hk --\u003e\" + hkOut);\n    String twOut = ChineseUtils.s2tw(text);\n    System.out.println(\"s2tw --\u003e \" + twOut);\n\n    String origin = ChineseUtils.t2s(out);\n    System.out.println(\"t2s --\u003e\" + origin);\n    System.out.println(\"hk2s --\u003e\" + ChineseUtils.hk2s(hkOut));\n    System.out.println(\"tw2s --\u003e\" + ChineseUtils.tw2s(twOut));\n}\n```\n\n输出结果如下\n\n```text\ns2t --\u003e這斜月三星洞…… 長壽麪，孫悟空，豬八戒，唐僧，沙和尚，白龍馬，李靖，托塔天王, 戲說西遊，許多人都這樣說，收拾一下，拾金不昧；纔=才\ns2hk --\u003e這斜月三星洞…… 長壽麪，孫悟空，豬八戒，唐僧，沙和尚，白龍馬，李靖，托塔天王, 戲説西遊，許多人都這樣説，收拾一下，拾金不昧；才=才\ns2tw --\u003e 這斜月三星洞…… 長壽麵，孫悟空，豬八戒，唐僧，沙和尚，白龍馬，李靖，托塔天王, 戲說西遊，許多人都這樣說，收拾一下，拾金不昧；才=才\nt2s --\u003e这斜月三星洞…… 长寿面，孙悟空，猪八戒，唐僧，沙和尚，白龙马，李靖，托塔天王, 戏说西游，许多人都这样说，收拾一下，拾金不昧；才=才\nhk2s --\u003e这斜月三星洞…… 长寿面，孙悟空，猪八戒，唐僧，沙和尚，白龙马，李靖，托塔天王, 戏说西游，许多人都这样说，收拾一下，拾金不昧；才=才\ntw2s --\u003e这斜月三星洞…… 长寿面，孙悟空，猪八戒，唐僧，沙和尚，白龙马，李靖，托塔天王, 戏说西游，许多人都这样说，收拾一下，拾金不昧；才=才\n```\n\n### 高性能接入\n\n**词典预加载**\n\n\u003e 当系统对性能要求较高时，可以考虑提前异步加载词典、避免首次使用加载词典导致开销高\n\n```java\n// 预热加载所有的词典\nChineseUtils.preLoad(true,TransType.values());\n\n// 预加载简体转繁体词典\n        ChineseUtils.\n\npreLoad(true,TransType.SIMPLE_TO_TRADITIONAL);\n\n// 预加载简繁互转词典\nChineseUtils.\n\npreLoad(true,TransType.SIMPLE_TO_TRADITIONAL, TransType.TRADITIONAL_TO_SIMPLE);\n```\n\n**卸载**\n\n\u003e 当内存敏感时，提前卸载无用词典减少内存占用\n\n```java\n// 卸载所有词典\nChineseUtils.unLoad(TransType.values());\n\n// 卸载简繁互转词典\nChineseUtils.unLoad(TransType.SIMPLE_TO_TRADITIONAL, TransType.TRADITIONAL_TO_SIMPLE);\n```\n\n**转换**\n\nChineseUtils封装了通用的字体转换接口，可以直接通过下面的方式实现转换\n\n```java\nChineseUtils.transfer(\"一灰灰blog\",TransType.SIMPLE_TO_TRADITIONAL);\n```\n\n**加载自定义转换词典**\n\n\u003e 若有一些自定义的转换词典，希望加载到转换词典中，可以调用下面的方法进行初始化\n\n在 0.2.16 以及之后的版本中，提供了自定义词典加载功能，使用姿势\n\n```java\nMap\u003cString, String\u003e map = new HashMap\u003c\u003e();\nmap.put(\"发展国家\", \"發达國家\");\nChineseUtils.loadAdditionalDict(TransType.SIMPLE_TO_TRADITIONAL, map);\n```\n\n**加载不参与转换的词典**\n\n\u003e 若自带的转换词典不满足需求，可以使用下面的方式将不参与转换的词加入词典\n\n在 0.2.16 以及之后的版本中，提供了自定义过滤词库加载功能，使用姿势如下\n\n```java\n// 简繁转换中，我们不希望将 国 -\u003e 转换为 國， 不希望将 发展国家 转换为 發展國家\nChineseUtils.loadExcludeDict(TransType.SIMPLE_TO_TRADITIONAL, Arrays.asList(\"发展国家\", \"国\"));\n\n// 验证示例:\nSystem.out.println(\"加载后：简=\u003e繁 ==\u003e\" \n        + ChineseUtils.s2t(\"中华人民共和国目前还处于发展国家行列，但他依然在快速发展中\"));\n\n// 输出内容为： 加载后：简=\u003e繁 ==\u003e中華人民共和国目前還處於发展国家行列，但他依然在快速發展中\n```\n\n上面适用于指定具体的某种转换类型，也可以使用下面的方式将不参与转换的词加入全局的转换中，这样实现不管是什么类型的转换，都维持原状\n\n```java\nChineseUtils.loadExcludeDict(Arrays.asList(\"发展国家\", \"国\"));\n```\n\n### 版本说明\n- 0.2.17\n    - [#31「棋圣」和「碁圣」繁体转简体问题处理](https://github.com/liuyueyi/quick-chinese-transfer/issues/31)\n    - [#26 繁体转简体会将“教廷”转换为“梵蒂冈”](https://github.com/liuyueyi/quick-chinese-transfer/issues/26)\n- 0.2.16\n    - [#18 新增自定义词库加载，自定义排除词加载](https://github.com/liuyueyi/quick-chinese-transfer/issues/18)\n- 0.2.15\n    - [#23 繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/23)\n- 0.2.14\n    - [#17 繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/17)\n    - [#19 繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/19)\n- 0.2.13\n    - [#15 那么\"标致\"和\"溜\"繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/15)\n- 0.2.12\n    - [#14 那么”繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/14)\n- 0.2.11\n    - [#13 “福斯”繁简转换问题](https://github.com/liuyueyi/quick-chinese-transfer/issues/13)\n- 0.2.10\n    - [#12 快取 高速缓存](https://github.com/liuyueyi/quick-chinese-transfer/issues/12)\n- 0.2.9\n    - [#11 娘 对象 签简体转繁体](https://github.com/liuyueyi/quick-chinese-transfer/issues/11)\n- 0.2.8\n    - [#10 翻转简 洛哈=\u003e洛哈特](https://github.com/liuyueyi/quick-chinese-transfer/issues/10)\n- 0.2.7\n    - [#9 繁转简 通道会变信道](https://github.com/liuyueyi/quick-chinese-transfer/issues/9)\n- 0.2.6\n    - [#8 繁转简： 那個人=\u003e神秘人](https://github.com/liuyueyi/quick-chinese-transfer/issues/8)\n- 0.2.5\n    - 删除 `唇\u003c=\u003e脣` 简繁转换\n        - [#6 修正簡繁轉換：唇\u003c=\u003e脣](https://github.com/liuyueyi/quick-chinese-transfer/issues/6)\n    - 支持同步/异步预加载词典、卸载词典\n        - [#7 支持词典异步预加载、卸载](https://github.com/liuyueyi/quick-chinese-transfer/issues/7)\n- 0.2.4\n    - 繁体转简体\n        - [#5 骼 繁转简错误](https://github.com/liuyueyi/quick-chinese-transfer/issues/5)\n- 0.2.3\n    - 繁体转简体\n        - [#4 乾 繁转简错误](https://github.com/liuyueyi/quick-chinese-transfer/issues/4)\n- 0.2.2\n    - 繁转简\n        - [#3 克拉转成克拉布](https://github.com/liuyueyi/quick-chinese-transfer/issues/3)\n- 0.2.1\n    - 繁转简： fix 奔驰，奶油，黄油转换异常\n- 0.2.0\n    - 修复链式转换\n- 0.1.0\n    - 简繁转换\n\n## 汉字笔画 (hanzi-writer)\n\n中文汉字的笔画拆解、动画绘制\n\n数字字典来自\n\n- [https://github.com/chanind/hanzi-writer](https://github.com/chanind/hanzi-writer)\n\n### 使用姿势\n\n**maven依赖**\n\n中央仓库导入依赖\n\n```xml\n\u003c!-- https://mvnrepository.com/artifact/com.github.liuyueyi/quick-transfer-core --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.liuyueyi\u003c/groupId\u003e\n    \u003cartifactId\u003ehanzi-writer\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**中央仓库 gradle**\n\n```gradle\n// https://mvnrepository.com/artifact/com.github.liuyueyi/quick-transfer-core\nimplementation 'com.github.liuyueyi:hanzi-writer:0.1.1'\n```\n\n**使用jitpack导入依赖**\n\n```xml\n\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependency\u003e\n\u003cgroupId\u003ecom.github.liuyueyi.quick-chinese-transfer\u003c/groupId\u003e\n\u003cartifactId\u003ehanzi-writer\u003c/artifactId\u003e\n\u003cversion\u003e0.2.17\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**gradle依赖**\n\n```gradle\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n\ndependencies {\n    implementation 'com.github.liuyueyi.quick-chinese-transfer:hanzi-writer:0.2.17'\n}\n```\n\n**基本使用演示**\n\n```java\nHanZiRenderResultVo vo = HanZiSvgGenerator\n        .newGenerator(\"帅\")\n        .setRenderStyle(RenderStyleEnum.TOTAL)\n        .setStrokeNumShow(true)\n        .setAnimateShow(true)\n        .setOutlineShow(true)\n        .setWriteTipShow(true)\n        .toSvgs();\n\n// svg 表示带动画 + 笔画 的svg格式\nString svg = vo.getSvg();\n// 逐笔绘制的效果\nList\u003cString\u003e strokeSvgList = vo.getStrokes();\n```\n\n几个关键的参数配置\n\n![](hanzi-writer/src/test/resources/struct.jpg)\n\n| 参数               | 类型        | 说明                            | 默认值                                                                                                                                                                                                                                                                   \n|------------------|-----------|-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `size`           | `int`     | 输出svg大小                       | `300`                                                                                                                                                                                                                                                                 |\n| `bgShow`         | `boolean` | 是否显示背景的田字格                    | `true`                                                                                                                                                                                                                                                                |\n| `bg`             | `string`  | 背景信息，田字格                      | `\u003cg stroke=\"lightgray\"stroke-dasharray=\"1,1\"stroke-width=\"1\"transform=\"scale(4, 4)\"\u003e\u003cline x1=\"0\"y1=\"0\"x2=\"256\"y2=\"256\"\u003e\u003c/line\u003e\u003cline x1=\"256\"y1=\"0\"x2=\"0\"y2=\"256\"\u003e\u003c/line\u003e\u003cline x1=\"128\"y1=\"0\"x2=\"128\"y2=\"256\"\u003e\u003c/line\u003e\u003cline x1=\"0\"y1=\"128\"x2=\"256\"y2=\"128\"\u003e\u003c/line\u003e\u003c/g\u003e` |\n| `outlineShow`    | `boolean` | 是否显示背景描边                      | `true`                                                                                                                                                                                                                                                                | \n| `outlineColor`   | `string`  | 背景描边色                         | `rgba(221,221,221,1)`                                                                                                                                                                                                                                                 |\n| `animateShow`    | `boolean` | 是否支持按笔画顺序进行动画展示               | `true`                                                                                                                                                                                                                                                                | \n| `drawColor`      | `string`  | 动画执行完之后的颜色                    | `rgb(85, 85, 85)`                                                                                                                                                                                                                                                     |\n| `midColor`       | `string`  | 动画执行过程中的颜色                    | `rgb(68, 68, 255)`                                                                                                                                                                                                                                                    |\n| `animateColor`   | `string`  | 动画开始执行的颜色                     | `rgb(187, 68, 68)`                                                                                                                                                                                                                                                    |\n| `animateSeconds` | `float`   | 动画时长(秒)                       | `0.9`                                                                                                                                                                                                                                                                 |\n| `writeTipShow`   | `boolean` | 是否显示绘制轮廓的提示                   | `true`                                                                                                                                                                                                                                                                |\n| `writeTipStyle`  | `string`  | 轮廓的提示样式                       | `.median-stroke{fill:none;stroke:rgb(15,15,15,0.5);stroke-width:2px;opacity:1}`                                                                                                                                                                                       |\n| `strokeNumShow`  | `boolean` | 是否显示笔画顺序的文字                   | `true`                                                                                                                                                                                                                                                                |\n| `strokeNumStyle` | `string`  | 笔画提示数字的格式                     | `text{font-family:Helvetica;font-size:50px;fill:#ffffff;paint-order:stroke;stroke:#000000;stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;font-weight:800}`                                                                                                |\n| `renderStyle`    | `enum`    | `NORMAL,STROKE_ANIMATE,TOTAL` | normal 表示只返回最终的svg, stroke_animate表示只返回笔画拆分结果,total前面两个都返回                                                                                                                                                                                                            |\n\n对应的svg显示样式如下\n\n![帅](hanzi-writer/src/test/resources/shuai.svg)\n\n| 1                                                | 2                                                | 3                                                | 4                                                | 5                                                |\n|--------------------------------------------------|--------------------------------------------------|--------------------------------------------------|--------------------------------------------------|--------------------------------------------------|\n| ![帅](hanzi-writer/src/test/resources/shuai1.svg) | ![帅](hanzi-writer/src/test/resources/shuai2.svg) | ![帅](hanzi-writer/src/test/resources/shuai3.svg) | ![帅](hanzi-writer/src/test/resources/shuai4.svg) | ![帅](hanzi-writer/src/test/resources/shuai5.svg) |\n\n### 版本说明\n\n- 0.1.1\n  - 新增GitHub Action，实现自动上传jar包到中央仓库\n- 0.1.0\n  - 完成初始版本\n\n## 中央仓库上传说明\n\n新版中央仓管理地址： [central.sonatype.com](https://central.sonatype.com/)\n\n基于GitHub Action实现自动上传jar包到中央仓库，由于不同模块版本号不一致，因此这里采用分支的触发方式\n\n1. hanzi: 分支上有变更，表示推送 hanzi-writer 模块到中央仓库\n2. transfer: 分支上有变更，表示推送 transfer-core 模块到中央仓库\n3. release: 分支上有变更，表示整个项目推送到中央仓库\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyueyi%2Fquick-chinese-transfer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuyueyi%2Fquick-chinese-transfer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyueyi%2Fquick-chinese-transfer/lists"}