Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodejieba

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejieba - npm Package Compare versions

Comparing version 1.4.11 to 2.0.0

8

ChangeLog.md
# NodeJieba ChangeLog
## v2.0.0
+ Upgrade cppjieba -> v4.8.0
+ rewrite `cut` function:
+ add `cutAll` for old `cut(s, "FULL")` function.
+ add `cutHMM` for old `cut(s, "HMM")` function.
+ add `cutForSearch` for old `cut(s, "Query")` function.
## v1.4.11

@@ -4,0 +12,0 @@

3

index.js

@@ -36,2 +36,5 @@ var nodejieba = require("./build/Release/nodejieba.node");

wrapWithDictLoad(nodejieba, "cut");
wrapWithDictLoad(nodejieba, "cutAll");
wrapWithDictLoad(nodejieba, "cutHMM");
wrapWithDictLoad(nodejieba, "cutForSearch");
wrapWithDictLoad(nodejieba, "tag");

@@ -38,0 +41,0 @@ wrapWithDictLoad(nodejieba, "extract");

2

package.json
{
"name": "nodejieba",
"description": "chinese word segmentation for node",
"version": "1.4.11",
"version": "2.0.0",
"author": "Yanyi Wu <i@yanyiwu.com>",

@@ -6,0 +6,0 @@ "maintainers": [

@@ -39,3 +39,3 @@ [![Build Status](https://travis-ci.org/yanyiwu/nodejieba.png?branch=master)](https://travis-ci.org/yanyiwu/nodejieba)

See details in `test/demo.js`
See details in [test/demo.js](test/demo.js)

@@ -50,3 +50,3 @@ ### POS Tagging

See details in `test/demo.js`
See details in [test/demo.js](test/demo.js)

@@ -57,7 +57,8 @@ ### Keyword Extractor

var nodejieba = require("nodejieba");
console.log(nodejieba.extract("升职加薪,当上CEO,走上人生巅峰。", 4));
var topN = 4;
console.log(nodejieba.extract("升职加薪,当上CEO,走上人生巅峰。", topN));
// [ 'CEO:11.7392', '升职:10.8562', '加薪:10.6426', '巅峰:9.49396' ]
```
See details in `test/demo.js`
See details in [test/demo.js](test/demo.js)

@@ -64,0 +65,0 @@ ## Testing

@@ -57,3 +57,3 @@ [![Build Status](https://travis-ci.org/yanyiwu/nodejieba.png?branch=master)](https://travis-ci.org/yanyiwu/nodejieba)

更详细的其他用法请看 `test/demo.js`
更详细的其他用法请看 [test/demo.js](test/demo.js)

@@ -111,3 +111,3 @@ ### 词典载入可灵活配置

具体用法参考 `test/demo.js`
更详细的其他用法请看 [test/demo.js](test/demo.js)

@@ -118,7 +118,8 @@ ### 关键词抽取

var nodejieba = require("nodejieba");
console.log(nodejieba.extract("升职加薪,当上CEO,走上人生巅峰。", 4));
var topN = 4;
console.log(nodejieba.extract("升职加薪,当上CEO,走上人生巅峰。", topN));
// [ 'CEO:11.7392', '升职:10.8562', '加薪:10.6426', '巅峰:9.49396' ]
```
具体用法参考 `test/demo.js`
更详细的其他用法请看 [test/demo.js](test/demo.js)

@@ -125,0 +126,0 @@ ## 测试

@@ -13,21 +13,19 @@ var nodejieba = require("../index.js");

result = nodejieba.cut(sentence, "MP");
result = nodejieba.cut(sentence, true);
console.log(result);
result = nodejieba.cut(sentence, "HMM");
result = nodejieba.cutHMM(sentence);
console.log(result);
result = nodejieba.cut(sentence, "MIX");
result = nodejieba.cutAll(sentence);
console.log(result);
result = nodejieba.cut(sentence, "FULL");
result = nodejieba.cutForSearch(sentence);
console.log(result);
result = nodejieba.cut(sentence, "QUERY");
console.log(result);
result = nodejieba.tag(sentence);
console.log(result);
result = nodejieba.extract(sentence, 5);
var topN = 5;
result = nodejieba.extract(sentence, topN);
console.log(result);

@@ -34,0 +32,0 @@

@@ -8,4 +8,4 @@ var should = require("should");

it("nodejieba.cut(sentence)", function() {
nodejieba.cut(sentence).should.eql([ '我',
it("nodejieba.cut(sentence, true)", function() {
nodejieba.cut(sentence, true).should.eql([ '我',
'是',

@@ -40,12 +40,12 @@ '拖拉机',

it("nodejieba.cut('南京市长江大桥', 'MP')", function() {
nodejieba.cut('南京市长江大桥', 'MP').should.eql([ '南京市', '长江大桥' ]);
it("nodejieba.cut('南京市长江大桥')", function() {
nodejieba.cut('南京市长江大桥').should.eql([ '南京市', '长江大桥' ]);
});
it("nodejieba.cut('南京市长江大桥', 'HMM')", function() {
nodejieba.cut('南京市长江大桥', 'HMM').should.eql([ '南京市', '长江大桥' ]);
it("nodejieba.cutHMM('南京市长江大桥')", function() {
nodejieba.cutHMM('南京市长江大桥').should.eql([ '南京市', '长江大桥' ]);
});
it("nodejieba.cut('南京市长江大桥', 'MIX')", function() {
nodejieba.cut('南京市长江大桥', 'MIX').should.eql([ '南京市', '长江大桥' ]);
it("nodejieba.cut('南京市长江大桥', true)", function() {
nodejieba.cut('南京市长江大桥', true).should.eql([ '南京市', '长江大桥' ]);
});

@@ -57,16 +57,16 @@

it("nodejieba.cut('南京长江大桥', 'MP')", function() {
nodejieba.cut('南京长江大桥', 'MP').should.eql([ '南京长江大桥' ]);
it("nodejieba.cut('南京长江大桥')", function() {
nodejieba.cut('南京长江大桥').should.eql([ '南京长江大桥' ]);
});
it("nodejieba.cut('南京长江大桥', 'HMM')", function() {
nodejieba.cut('南京长江大桥', 'HMM').should.eql([ '南京长', '江大桥' ]);
it("nodejieba.cutHMM('南京长江大桥')", function() {
nodejieba.cutHMM('南京长江大桥').should.eql([ '南京长', '江大桥' ]);
});
it("nodejieba.cut('南京长江大桥', 'MIX')", function() {
nodejieba.cut('南京长江大桥', 'MIX').should.eql([ '南京长江大桥' ]);
it("nodejieba.cut('南京长江大桥', true)", function() {
nodejieba.cut('南京长江大桥', true).should.eql([ '南京长江大桥' ]);
});
it('nodejieba.cut(sentence, "MP")', function() {
nodejieba.cut(sentence, "MP").should.eql([ '我',
it('nodejieba.cut(sentence)', function() {
nodejieba.cut(sentence).should.eql([ '我',
'是',

@@ -100,4 +100,4 @@ '拖拉机',

it('nodejieba.cut(sentence, "HMM")', function() {
nodejieba.cut(sentence, "HMM").should.eql([ '我',
it('nodejieba.cutHMM(sentence)', function() {
nodejieba.cutHMM(sentence).should.eql([ '我',
'是',

@@ -129,4 +129,4 @@ '拖拉机',

it('nodejieba.cut(sentence, "MIX")', function() {
nodejieba.cut(sentence, "MIX").should.eql([ '我',
it('nodejieba.cut(sentence, true)', function() {
nodejieba.cut(sentence, true).should.eql([ '我',
'是',

@@ -157,4 +157,4 @@ '拖拉机',

it('nodejieba.cut(sentence, "FULL")', function() {
nodejieba.cut(sentence, "FULL").should.eql([ '我',
it('nodejieba.cutAll(sentence)', function() {
nodejieba.cutAll(sentence).should.eql([ '我',
'是',

@@ -191,11 +191,12 @@ '拖拉',

it('nodejieba.cut(sentence, "QUERY")', function() {
nodejieba.cut(sentence, "QUERY").should.eql([ '我',
it('nodejieba.cutForSearch(sentence, true)', function() {
nodejieba.cutForSearch(sentence, true).should.eql([ '我',
'是',
'拖拉',
'拖拉机',
'学院',
'手扶',
'手扶拖拉机',
'拖拉',
'拖拉机',
'手扶拖拉机',
'专业',

@@ -266,4 +267,4 @@ '的',

it('nodejieba.cut("男默女泪")', function() {
nodejieba.cut("男默女泪").should.eql([ '男默',
'女泪' ]);
nodejieba.cut("男默女泪").should.eql([ '男', '默',
'女', '泪' ]);
});

@@ -277,5 +278,2 @@ it('nodejieba.insertWord("男默女泪")', function() {

it('nodejieba.cut("南京市长江大桥")', function() {
nodejieba.cut("南京市长江大桥", "MP", 3).should.eql([ '南京市', '长江', '大桥' ]);
});
it('nodejieba.cut("今天天气很好,🙋 我们去郊游。")', function() {

@@ -282,0 +280,0 @@ nodejieba.cut("今天天气很好,🙋 我们去郊游。").should.eql([ '今天天气', '很', '好', ',', '🙋', ' ', '我们', '去', '郊游', '。' ]);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc