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 0.2.0 to 0.2.1

src/mix_segment.cpp

4

ChangeLog.md

@@ -0,1 +1,5 @@

## v0.2.1
* 增加搜索引擎分词模式,分别对应的调用函数是 `queryLoadDict, queryCutSync, queryCut`。
## v0.2.0

@@ -2,0 +6,0 @@

4

package.json
{
"name": "nodejieba",
"description": "chinese segment for node",
"version": "0.2.0",
"version": "0.2.1",
"author": "Yanyi Wu <wuyanyi09@gmail.com>",

@@ -28,5 +28,5 @@ "maintainers": [

"scripts": {
"test": "node test/segment.js"
"test": "node test/segment.js && node test/query_segment.js"
},
"license": "MIT"
}

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

## Example
## Install

@@ -28,11 +28,68 @@ ```sh

## Usage
demo.js示例
### 默认分词算法
#### 初始化
```js
var segment = require("nodejieba");
segment.loadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");
console.log(segment.cut("南京市长江大桥"));
```
#### 阻塞式调用
```js
var wordList = segment.cutSync("阻塞模式分词");
if (wordList.constructor == Array) // just for tutorial, this is always be true
{
wordList.forEach(function(word) {
console.log(word);
});
}
```
#### 非阻塞式调用
```js
segment.cut("非阻塞模式分词", function(wordList) {
wordList.forEach(function(word) {
console.log(word);
});
});
```
### 搜索引擎分词算法
#### 初始化
```js
var segment = require("nodejieba");
segment.queryLoadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");
```
#### 阻塞式调用
```js
var wordList = segment.queryCutSync("阻塞模式分词");
if (wordList.constructor == Array) // just for tutorial, this is always be true
{
wordList.forEach(function(word) {
console.log(word);
});
}
```
#### 非阻塞式调用
```js
segment.queryCut("非阻塞模式分词", function(wordList) {
wordList.forEach(function(word) {
console.log(word);
});
});
```
具体用法可以参考 `test/segment.js test/query_segment.js`
## Testing

@@ -51,5 +108,6 @@

## Contact
## Author
wuyanyi09@gmail.com
- aszxqw https://github.com/aszxqw wuyanyi09@gmail.com
- myl2821 https://github.com/myl2821 myl2821@gmail.com

@@ -56,0 +114,0 @@ [NodeJiebaBlog]:http://www.aszxqw.com/work/2014/02/22/nodejs-cpp-addon-nodejieba.html

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