{"id":23267318,"url":"https://github.com/sotch-pr35mac/chinese-dictionary","last_synced_at":"2025-07-21T11:32:24.086Z","repository":{"id":40449319,"uuid":"331832196","full_name":"sotch-pr35mac/chinese-dictionary","owner":"sotch-pr35mac","description":"A searchable Chinese / English dictionary with helpful utilities.","archived":false,"fork":false,"pushed_at":"2022-08-02T04:29:29.000Z","size":97,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T22:44:05.087Z","etag":null,"topics":["characters","chinese","dictionary","english","hanzi","pinyin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/chinese-dictionary","language":"Rust","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/sotch-pr35mac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-01-22T04:03:51.000Z","updated_at":"2025-03-22T02:32:38.000Z","dependencies_parsed_at":"2022-09-04T13:10:20.787Z","dependency_job_id":null,"html_url":"https://github.com/sotch-pr35mac/chinese-dictionary","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sotch-pr35mac/chinese-dictionary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sotch-pr35mac%2Fchinese-dictionary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sotch-pr35mac%2Fchinese-dictionary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sotch-pr35mac%2Fchinese-dictionary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sotch-pr35mac%2Fchinese-dictionary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sotch-pr35mac","download_url":"https://codeload.github.com/sotch-pr35mac/chinese-dictionary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sotch-pr35mac%2Fchinese-dictionary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266291730,"owners_count":23906322,"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":["characters","chinese","dictionary","english","hanzi","pinyin"],"created_at":"2024-12-19T16:54:01.711Z","updated_at":"2025-07-21T11:32:24.070Z","avatar_url":"https://github.com/sotch-pr35mac.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chinese-dictionary\n\n[![Build Status](https://travis-ci.com/sotch-pr35mac/chinese-dictionary.svg?branch=master)](https://travis-ci.com/sotch-pr35mac/chinese-dictionary)\n\n### About\n\nA searchable Chinese / English dictionary with helpful utilities.\n\n### Features\n- Search with Traditional Chinese characters, Simplified Chinese characters, pinyin with tone marks, pinyin with tone numbers, pinyin with no tones, and English.\n- Classify a string of text as either English, Pinyin, or Chinese characters.\n- Convert between Traditional and Simplified Chinese characters.\n- Segment strings of Chinese characters into tokens using a dictionary-driven segmentation approach.\n\n### Installation\n\n```bash\nnpm install chinese-dictionary --save\n```\n\n### Usage\nInitialization is optional. If `.init()` is not called required values will be lazy loaded once.\n```js\nconst dictionary = require('chinese-dictionary');\n\n// Make a query directly\ndictionary.query('test').then(result =\u003e console.log(result));\n\n// Or make a query once required data is loaded\ndictionary.init().then(() =\u003e dictionary.query('test').then(result =\u003e console.log(result)));\n```\n\nQuerying the dictionary\n```js\nconst dictionary = require('chinese-dictionary');\n\ndictionary.init().then(() =\u003e { \n\tdictionary.query('test').then(result =\u003e {\n\t\t// Learn more about the dictionary entry format below\n\t\tconsole.log(result[0].simplified); // --\u003e '实验'\n\t});\n});\n```\n\nClassying a string of text\n```js\nconst dictionary = require('chinese-dictionary');\n\ndictionary.init().then(() =\u003e { \n\tdictionary.classify('test').then(result =\u003e {\n\t\t// There are four possible return options\n\t\t// from the classify function:\n\t\t// 'EN' --\u003e Represents the text was in English\n\t\t// 'PY' --\u003e Represents the text was in Pinyin\n\t\t// 'ZH' --\u003e Represents the text was in Chinese Characters\n\t\t// 'UN' --\u003e Represents the classification result was uncertain\n\t\tconsole.log(result); // --\u003e 'EN'\n\t});\n});\n```\n\nConvert between Traditional and Simplified Chinese characters\n```js\nconst dictionary = require('chinese-dictionary');\n\ndictionary.init().then(() =\u003e { \n\tdictionary.convertToTraditional('实验').then(result =\u003e console.log(result)); // --\u003e 實驗\n\tdictionary.convertToSimplified('實驗').then(result =\u003e console.log(result)); // --\u003e 实验\n\n\tconsole.log(dictionary.isSimplified('实验')); // --\u003e true\n\tconsole.log(dictionary.isTraditional('實驗')); // --\u003e true\n});\n```\n\nSegment a string of characters\n```js\nconst dictionary = require('chinese-dictionary');\n\ndictionary.init().then(() =\u003e { \n\tdictionary.segment('今天天气不错').then(result =\u003e console.log(result)); // --\u003e ['今天', '天气', '不错']\n});\n```\n\n### Dictionary Entry Format\n```js\n{\n\ttraditional: '天氣',\n\tsimplified: '天气',\n\tpinyinMarks: 'tiān qì',\n\tpinyinNumbers: 'tian1 qi4',\n\tenglish: ['weather'],\n\ttoneMarks: [1, 4],\n\thash: '999999999...',\n\thsk: 1,\n\tword_id: 123456,\n\tmeasureWords: [\n\t\t{\n\t\t\ttraditional: '個',\n\t\t\tsimplified: '个',\n\t\t\tpinyinMarks: 'gè',\n\t\t\tpinyinNumbers: 'ge4'\n\t\t}\n\t]\n}\n```\n\n### License\nThis software is licensed under the [MIT License](https://github.com/sotch-pr35mac/chinese-dictionary/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsotch-pr35mac%2Fchinese-dictionary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsotch-pr35mac%2Fchinese-dictionary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsotch-pr35mac%2Fchinese-dictionary/lists"}