{"id":15639282,"url":"https://github.com/azu/kuromojin","last_synced_at":"2025-04-06T10:12:49.115Z","repository":{"id":52593069,"uuid":"46095916","full_name":"azu/kuromojin","owner":"azu","description":"Provide a high-level wrapper for kuromoji.js. Cache/Promise API","archived":false,"fork":false,"pushed_at":"2024-01-06T04:07:34.000Z","size":15319,"stargazers_count":92,"open_issues_count":3,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T08:11:54.670Z","etag":null,"topics":["japanese","javascript","kuromoji","promise"],"latest_commit_sha":null,"homepage":"https://kuromojin.netlify.app/","language":"CSS","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/azu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"azu"}},"created_at":"2015-11-13T02:52:23.000Z","updated_at":"2025-02-19T03:57:05.000Z","dependencies_parsed_at":"2024-01-06T04:42:54.643Z","dependency_job_id":null,"html_url":"https://github.com/azu/kuromojin","commit_stats":{"total_commits":63,"total_committers":4,"mean_commits":15.75,"dds":0.1428571428571429,"last_synced_commit":"df46fe9c81c1c8f8f17b17254884429221df9c60"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fkuromojin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fkuromojin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fkuromojin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fkuromojin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/kuromojin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464222,"owners_count":20942970,"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":["japanese","javascript","kuromoji","promise"],"created_at":"2024-10-03T11:25:16.272Z","updated_at":"2025-04-06T10:12:49.096Z","avatar_url":"https://github.com/azu.png","language":"CSS","funding_links":["https://github.com/sponsors/azu"],"categories":["CSS"],"sub_categories":[],"readme":"# kuromojin [![Actions Status: test](https://github.com/azu/kuromojin/workflows/test/badge.svg)](https://github.com/azu/kuromojin/actions?query=workflow%3A\"test\")\n\nProvide a high level wrapper for [kuromoji.js](https://github.com/takuyaa/kuromoji.js \"kuromoji.js\").\n\n## Features\n\n- Promise based API\n- Cache Layer\n    - Fetch the dictionary at once\n    - Return same tokens for same text\n\n## Installation\n\n    npm install kuromojin\n\n## Online Playground\n\n📝 Require [DecompressionStream](https://developer.mozilla.org/ja/docs/Web/API/DecompressionStream) supported browser\n\n- \u003chttps://kuromojin.netlify.app/\u003e\n\n## Usage\n\nExport two API.\n\n- `getTokenizer()` return `Promise` that is resolved with kuromoji.js's `tokenizer` instance.\n- `tokenize()` return `Promise` that is resolved with analyzed tokens.\n\n```js\nimport {tokenize, getTokenizer} from \"kuromojin\";\n\ngetTokenizer().then(tokenizer =\u003e {\n    // kuromoji.js's `tokenizer` instance\n});\n\ntokenize(text).then(tokens =\u003e {\n    console.log(tokens)\n    /*\n    [ {\n        word_id: 509800,          // 辞書内での単語ID\n        word_type: 'KNOWN',       // 単語タイプ(辞書に登録されている単語ならKNOWN, 未知語ならUNKNOWN)\n        word_position: 1,         // 単語の開始位置\n        surface_form: '黒文字',    // 表層形\n        pos: '名詞',               // 品詞\n        pos_detail_1: '一般',      // 品詞細分類1\n        pos_detail_2: '*',        // 品詞細分類2\n        pos_detail_3: '*',        // 品詞細分類3\n        conjugated_type: '*',     // 活用型\n        conjugated_form: '*',     // 活用形\n        basic_form: '黒文字',      // 基本形\n        reading: 'クロモジ',       // 読み\n        pronunciation: 'クロモジ'  // 発音\n      } ]\n    */\n});\n```\n\n### For browser/global options\n\nIf `window.kuromojin.dicPath` is defined, kuromojin use it as default dict path.\n\n```js\nimport {getTokenizer} from \"kuromojin\";\n// Affect all module that are used kuromojin.\nwindow.kuromojin = {\n    dicPath: \"https://cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict\"\n};\n// this `getTokenizer` function use \"https://kuromojin.netlify.com/dict\" \ngetTokenizer();\n// === \ngetTokenizer({dicPath: \"https://cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict\"})\n```\n\n:memo: Test dictionary URL\n\n- \"https://cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict\"\n    - cdn dict for kuromoji.js\n- https://kuromojin.netlify.com/dict/*.dat.gz\n    - example: https://kuromojin.netlify.com/dict/base.dat.gz\n\n### Note: backward compatibility for \u003c= 1.1.0\n\nkuromojin v1.1.0 export `tokenize` as default function.\n\nkuromojin v2.0.0 remove the default function.\n\n```js\nimport kuromojin from \"kuromojin\";\n// kuromojin === tokenize\n```\n\nRecommended: use `import {tokenize} from \"kuromojin\"` instead of it\n\n```js\nimport {tokenize} from \"kuromojin\";\n```\n\n### Note: kuromoji version is pinned\n\nkuromojin pin kuromoji's version.\n\nIt aim to dedupe kuromoji's dictionary.\nThe dictionary is large and avoid to duplicated dictionary. \n\n## Related\n\n- [azu/morpheme-match: match function that match token(形態素解析) with sentence.](https://github.com/azu/morpheme-match/tree/master)\n\n## Tests\n\n    npm test\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fkuromojin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fkuromojin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fkuromojin/lists"}