Comparing version 0.2.0 to 0.2.1
@@ -0,1 +1,5 @@ | ||
## v0.2.1 | ||
* 增加搜索引擎分词模式,分别对应的调用函数是 `queryLoadDict, queryCutSync, queryCut`。 | ||
## v0.2.0 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5697732
41
26
115