{"name":"nodejieba","version":"3.4.2","keywords":["chinese","segment","cppjieba","jieba","中文分词","结巴分词"],"author":{"name":"Yanyi Wu","email":"wuyanyi09@foxmail.com"},"license":"MIT","_id":"nodejieba@3.4.2","homepage":"https://github.com/yanyiwu/nodejieba#readme","bugs":{"url":"https://github.com/yanyiwu/nodejieba/issues"},"dist":{"shasum":"f46473018acc40bbc27566cf8a5a44cefa4a048e","tarball":"http://registry-npm.ywwl.com/nodejieba/download/nodejieba-3.4.2.tgz","fileCount":343,"integrity":"sha512-0OvQX4czTFy4U/D+G2mteUxdjpiwbd/GjNWaHdJqMqpoIgjIdS2gPiXyfq8eUv9YT2rtlpddY/qezcGaryMeug==","signatures":[{"sig":"MEYCIQDTsO5UG2AQzu2YjoYbaLXOOvhbt6+mnVdlRnCeD/RvMQIhAK5Hpw+ONK0sRHMOd92VrfiXDXmzbOd86koO4guwBNPu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24570864,"size":8734034,"noattachment":false,"key":"/nodejieba/-/nodejieba-3.4.2.tgz"},"main":"./index.js","binary":{"host":"https://github.com/yanyiwu/nodejieba/releases/download/","module_name":"nodejieba","module_path":"./build/Release/","remote_path":"v{version}","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz"},"engines":{"node":">= 10.20.0"},"gitHead":"e446c070b745dd53ec98372b4e8a3b23f027a665","scripts":{"test":"mocha --timeout 10s -R spec test/test.js && mocha --timeout 10s -R spec test/load_dict_test.js","install":"node-pre-gyp install --fallback-to-build","rebuild":"node-pre-gyp rebuild"},"typings":"types/index.d.ts","_npmUser":{"name":"yanyiwu","email":"64162451@qq.com"},"repository":{"url":"git+ssh://git@github.com/yanyiwu/nodejieba.git","type":"git"},"_npmVersion":"10.7.0","description":"chinese word segmentation for node","directories":{},"_nodeVersion":"18.20.4","dependencies":{"node-addon-api":"^3.0.2","@mapbox/node-pre-gyp":"^1.0.9"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"~10.7.3","should":"~8.3.1","typescript":"^3.0.1","node-pre-gyp-github":"^1.4.3"},"_npmOperationalInternal":{"tmp":"tmp/nodejieba_3.4.2_1724470378064_0.4542270708179341","host":"s3://npm-registry-packages"},"readme":"[![Build Status](https://github.com/yanyiwu/nodejieba/actions/workflows/test.yml/badge.svg)](https://github.com/yanyiwu/nodejieba/actions/workflows/test.yml)\n[![Financial Contributors on Open Collective](https://opencollective.com/nodejieba/all/badge.svg?label=financial+contributors)](https://opencollective.com/nodejieba) [![Author](https://img.shields.io/badge/author-@yanyiwu-blue.svg?style=flat)](https://github.com/yanyiwu/) \n[![Platform](https://img.shields.io/badge/platform-Linux,macOS,Windows-green.svg?style=flat)](https://github.com/yanyiwu/nodejieba)\n[![Performance](https://img.shields.io/badge/performance-excellent-brightgreen.svg?style=flat)](https://github.com/yanyiwu/blog/blob/posts2023archive/_posts/2015-06-14-jieba-series-performance-test.md) \n[![License](https://img.shields.io/badge/license-MIT-yellow.svg?style=flat)](http://yanyiwu.mit-license.org)\n[![NpmDownload Status](http://img.shields.io/npm/dm/nodejieba.svg)](https://www.npmjs.org/package/nodejieba)\n[![NPM Version](https://img.shields.io/npm/v/nodejieba.svg?style=flat)](https://www.npmjs.org/package/nodejieba)\n[![Code Climate](https://codeclimate.com/github/yanyiwu/nodejieba/badges/gpa.svg)](https://codeclimate.com/github/yanyiwu/nodejieba)\n- - -\n\n# NodeJieba \"结巴\"分词的Node.js版本\n\n## 介绍 \n\n`NodeJieba`是\"结巴\"中文分词的 Node.js 版本实现，\n由[CppJieba]提供底层分词算法实现，\n是兼具高性能和易用性两者的 Node.js 中文分词组件。\n\n## 特点\n\n+ 词典载入方式灵活，无需配置词典路径也可使用，需要定制自己的词典路径时也可灵活定制。\n+ 底层算法实现是C++，性能高效。\n+ 支持多种分词算法，各种分词算法见[CppJieba]的README.md介绍。\n+ 支持动态补充词库。\n\n对实现细节感兴趣的请看如下博文：\n\n+ [Node.js的C++扩展初体验之NodeJieba] \n+ [由NodeJieba谈谈Node.js异步实现] \n\n## 下载\n\n```sh\nnpm install nodejieba\n```\n\n## 用法\n\n```js\nvar nodejieba = require(\"nodejieba\");\nvar result = nodejieba.cut(\"南京市长江大桥\");\nconsole.log(result);\n//[\"南京市\",\"长江大桥\"]\n```\n\nMore Detals in [demo](https://github.com/yanyiwu/nodejieba-demo)\n\n### 词典载入可灵活配置\n\n如果没有主动调用词典函数时，\n则会在第一次调用cut等功能函数时，自动载入默认词典。\n\n如果要主动触发词典载入，则使用以下函数主动触发。\n\n```js\nnodejieba.load();\n```\n\n以上用法会自动载入所有默认词典，\n如果需要载入自己的词典，而不是默认词典。\n比如想要载入自己的用户词典，则使用以下函数：\n\n```js\nnodejieba.load({\n  userDict: './test/testdata/userdict.utf8',\n});\n```\n\n字典载入函数load的参数项都是可选的，\n如果没有对应的项则自动填充默认参数。\n所以上面这段代码和下面这代代码是等价的。\n\n```js\nnodejieba.load({\n  dict: nodejieba.DEFAULT_DICT,\n  hmmDict: nodejieba.DEFAULT_HMM_DICT,\n  userDict: './test/testdata/userdict.utf8',\n  idfDict: nodejieba.DEFAULT_IDF_DICT,\n  stopWordDict: nodejieba.DEFAULT_STOP_WORD_DICT,\n});\n```\n\n#### 词典说明\n\n+ dict: 主词典，带权重和词性标签，建议使用默认词典。\n+ hmmDict: 隐式马尔科夫模型，建议使用默认词典。\n+ userDict: 用户词典，建议自己根据需要定制。\n+ idfDict: 关键词抽取所需的idf信息。\n+ stopWordDict: 关键词抽取所需的停用词列表。\n\n### 词性标注\n\n```js\nvar nodejieba = require(\"nodejieba\");\nconsole.log(nodejieba.tag(\"红掌拨清波\"));\n//[ { word: '红掌', tag: 'n' },\n//  { word: '拨', tag: 'v' },\n//  { word: '清波', tag: 'n' } ]\n```\n\nMore Detals in [demo](https://github.com/yanyiwu/nodejieba-demo)\n\n### 关键词抽取\n\n```js\nvar nodejieba = require(\"nodejieba\");\nvar topN = 4;\nconsole.log(nodejieba.extract(\"升职加薪，当上CEO，走上人生巅峰。\", topN));\n//[ { word: 'CEO', weight: 11.739204307083542 },\n//  { word: '升职', weight: 10.8561552143 },\n//  { word: '加薪', weight: 10.642581114 },\n//  { word: '巅峰', weight: 9.49395840471 } ]\n\nconsole.log(nodejieba.textRankExtract(\"升职加薪，当上CEO，走上人生巅峰。\", topN));\n//[ { word: '当上', weight: 1 },\n//  { word: '不用', weight: 0.9898479330698993 },\n//  { word: '多久', weight: 0.9851260595435759 },\n//  { word: '加薪', weight: 0.9830464899847804 },\n//  { word: '升职', weight: 0.9802777682279076 } ]\n```\n\nMore Detals in [demo](https://github.com/yanyiwu/nodejieba-demo)\n\n## Develop NodeJieba\n\n```sh\ngit clone --recurse-submodules https://github.com/yanyiwu/nodejieba.git\ncd nodejieba\nnpm install\nnpm test\n```\n\n## 应用\n\n+ 支持中文搜索的 gitbook 插件: [gitbook-plugin-search-pro]\n+ 汉字拼音转换工具: [pinyin]\n\n## 性能评测\n\n应该是目前性能最好的 Node.js 中文分词库\n详见: [Jieba中文分词系列性能评测]\n\n\n[由NodeJieba谈谈Node.js异步实现]:https://github.com/yanyiwu/blog/blob/posts2023archive/_posts/2015-03-21-nodejs-asynchronous-insight.md\n[Node.js的C++扩展初体验之NodeJieba]:https://github.com/yanyiwu/blog/blob/posts2023archive/_posts/2014-02-22-nodejs-cpp-addon-nodejieba.md\n[CppJieba]:https://github.com/yanyiwu/cppjieba.git\n[cnpm]:http://cnpmjs.org\n[Jieba中文分词]:https://github.com/fxsjy/jieba\n\n[Jieba中文分词系列性能评测]:https://github.com/yanyiwu/blog/blob/posts2023archive/_posts/2015-06-14-jieba-series-performance-test.md\n[contributors]:https://github.com/yanyiwu/nodejieba/graphs/contributors\n[YanyiWu]:http://github.com/yanyiwu\n[gitbook-plugin-search-pro]:https://plugins.gitbook.com/plugin/search-pro\n[pinyin]:https://github.com/hotoo/pinyin\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n<a href=\"https://github.com/yanyiwu/nodejieba/graphs/contributors\"><img src=\"https://opencollective.com/nodejieba/contributors.svg?width=890&button=false\" /></a>\n\n### Financial Contributors\n\nBecome a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/nodejieba/contribute)]\n\n#### Individuals\n\n<a href=\"https://opencollective.com/nodejieba\"><img src=\"https://opencollective.com/nodejieba/individuals.svg?width=890\"></a>\n\n#### Organizations\n\nSupport this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/nodejieba/contribute)]\n\n<a href=\"https://opencollective.com/nodejieba/organization/0/website\"><img src=\"https://opencollective.com/nodejieba/organization/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/1/website\"><img src=\"https://opencollective.com/nodejieba/organization/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/2/website\"><img src=\"https://opencollective.com/nodejieba/organization/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/3/website\"><img src=\"https://opencollective.com/nodejieba/organization/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/4/website\"><img src=\"https://opencollective.com/nodejieba/organization/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/5/website\"><img src=\"https://opencollective.com/nodejieba/organization/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/6/website\"><img src=\"https://opencollective.com/nodejieba/organization/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/7/website\"><img src=\"https://opencollective.com/nodejieba/organization/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/8/website\"><img src=\"https://opencollective.com/nodejieba/organization/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/nodejieba/organization/9/website\"><img src=\"https://opencollective.com/nodejieba/organization/9/avatar.svg\"></a>\n","publish_time":1724470378320,"maintainers":[{"name":"yanyiwu","email":"64162451@qq.com"},{"name":"luckykaiyi","email":"kaiyi0707@163.com"}],"_cnpm_publish_time":1724470378320,"dist-tags":{"latest":"3.5.8"}}