{"id":15399156,"url":"https://github.com/kaifuny/pinyin4js","last_synced_at":"2026-03-07T00:33:11.777Z","repository":{"id":41882583,"uuid":"89425269","full_name":"Kaifuny/pinyin4js","owner":"Kaifuny","description":"A opensource javascript library for converting chinese to pinyin。welcome Star : P","archived":false,"fork":false,"pushed_at":"2022-02-14T02:07:39.000Z","size":666,"stargazers_count":176,"open_issues_count":3,"forks_count":54,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-06T12:08:14.674Z","etag":null,"topics":["browser","chinese","javascript","javascript-library","node","pinyin","pinyin4js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kaifuny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-26T01:48:43.000Z","updated_at":"2025-05-20T09:08:49.000Z","dependencies_parsed_at":"2022-07-08T23:30:15.703Z","dependency_job_id":null,"html_url":"https://github.com/Kaifuny/pinyin4js","commit_stats":null,"previous_names":["superbiger/pinyin4js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kaifuny/pinyin4js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaifuny%2Fpinyin4js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaifuny%2Fpinyin4js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaifuny%2Fpinyin4js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaifuny%2Fpinyin4js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaifuny","download_url":"https://codeload.github.com/Kaifuny/pinyin4js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaifuny%2Fpinyin4js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266567639,"owners_count":23949391,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["browser","chinese","javascript","javascript-library","node","pinyin","pinyin4js"],"created_at":"2024-10-01T15:47:10.099Z","updated_at":"2026-03-07T00:33:11.712Z","avatar_url":"https://github.com/Kaifuny.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[[English Document](https://github.com/superbiger/pinyin4js/blob/master/README_EN.md)]\n[[中文文档](https://github.com/superbiger/pinyin4js/blob/master/README.md)]\n \n## pinyin4js  \n\u003ca href=\"https://codebeat.co/projects/github-com-superbiger-pinyin4js-master\"\u003e\u003cimg alt=\"codebeat badge\" src=\"https://codebeat.co/badges/66eb52ae-bd9e-47d6-84cd-8c01cc01b46f\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/pinyin4js\"\u003e\u003cimg src=\"https://img.shields.io/npm/dy/pinyin4js.svg\" alt=\"Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/pinyin4js\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/pinyin4js.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/pinyin4js\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/pinyin4js.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003e pinyin4js是一个汉字转拼音的Javascript开源库-零依赖  \n\u003e A opensource javascript library for converting chinese to pinyin  \nThanks for [JPinyin](https://github.com/stuxuhai/jpinyin)  \n\u003e 注：同时支持Node和浏览器使用！！！  \n\u003e Demo Online: https://npm.runkit.com/pinyin4js\n\n## Features\n* **零依赖**  \n\n* **词库灵活导入,打包**   \n可以自行调整字典，具体可以参照src/dict；所有资源调用由PinyinResource封装，可自行修改后打包  \n\n* **准确、完善的字库**  \nUnicode编码从4E00-9FA5范围及3007（〇）的20903个汉字中，pinyin4js能转换除46个异体字（异体字不存在标准拼音）之外的所有汉字  \n\n* **拼音转换速度快**  \n经测试，从4E00-9FA5范围的20902个汉字，pinyin4js耗时约110毫秒\n\n* **多拼音格式输出支持**  \n支持多种拼音输出格式：带音标、不带音标、数字表示音标以及拼音首字母输出格式  \n\n* **常见多音字识别**  \n支持常见多音字的识别，其中包括词组、成语、地名等  \n\n* **简繁体中文转换**  \n\n* **支持添加自定义字典**  \n支持添加用户自定义字典\n\n## How to use\n\n* **INSTALL**\n\u003e Brower\n```html\n    \u003cscript src=\"./dist/pinyin4js.js\"\u003e\u003c/script\u003e\n```\n\u003e Node\n```\n    npm install pinyin4js\n```\n\n* **USE**\n\n#### Node\n\n```javascript\n    //pinyin4js@1.3.16 or latest\n    import pinyin4js from 'pinyin4js';\n\n    // more detail methods in test\n    // WITH_TONE_NUMBER--数字代表声调，WITHOUT_TONE--不带声调，WITH_TONE_MARK--带声调\n\n    // output: xià#mén#nǐ#hǎo#dà#shà#xià#mén\n    console.log(pinyin4js.convertToPinyinString('厦门你好大厦厦门', '#', pinyin4js.WITH_TONE_MARK))\n\n    //首字母风格\n    // output: xmnhdsxm\n    console.log(pinyin4js.convertToPinyinString('厦门你好大厦厦门', '', pinyin4js.FIRST_LETTER))\n    // or\n    console.log(pinyin4js.getShortPinyin('厦门你好大厦厦门'))\n```\n\n#### Browers\n\n```javascript\n    // \u003cscript src=\"./dist/pinyin4js.js\"\u003e\u003c/script\u003e\n\n    // output: xià#mén#nǐ#hǎo#dà#shà#xià#mén\n    console.log(PinyinHelper.convertToPinyinString('厦门你好大厦厦门', '#', PinyinFormat.WITH_TONE_MARK))\n\n    //首字母风格\n    // output: xmnhdsxm\n    console.log(PinyinHelper.convertToPinyinString('厦门你好大厦厦门', '', PinyinFormat.FIRST_LETTER))\n    // or\n    console.log(PinyinHelper.getShortPinyin('厦门你好大厦厦门'))\n```\n\n## How to Dev\n\n* **Init**\n```\n    git clone https://github.com/superbiger/pinyin4js.git\n    cd pinyin4js\n    npm install\n    npm run build\n```  \n\n* **Build Browser**\n```\n    npm run build\n    npm run build-browser   // PS: 打包浏览器包，必须先执行npm run build\n```  \n\n* **Test**\n```\n    npm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaifuny%2Fpinyin4js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaifuny%2Fpinyin4js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaifuny%2Fpinyin4js/lists"}