Comparing version 2.2.7 to 2.3.0
# NodeJieba ChangeLog | ||
## v2.3.0 | ||
+ merged [pull request 125](https://github.com/yanyiwu/nodejieba/pull/125) | ||
## v2.2.7 | ||
@@ -4,0 +8,0 @@ |
17
index.js
var nodejieba = require( __dirname + "/build/Release/nodejieba.node"); | ||
nodejieba.DEFAULT_DICT = __dirname + "/dict/jieba.dict.utf8", | ||
nodejieba.DEFAULT_HMM_DICT = __dirname + "/dict/hmm_model.utf8", | ||
nodejieba.DEFAULT_DICT = __dirname + "/dict/jieba.dict.utf8"; | ||
nodejieba.DEFAULT_HMM_DICT = __dirname + "/dict/hmm_model.utf8"; | ||
nodejieba.DEFAULT_USER_DICT = __dirname + "/dict/user.dict.utf8"; | ||
@@ -23,3 +23,3 @@ nodejieba.DEFAULT_IDF_DICT = __dirname + "/dict/idf.utf8"; | ||
return someFunct.call(this, dict, hmmDict, userDict, idfDict, stopWordDict); | ||
} | ||
}; | ||
@@ -43,5 +43,16 @@ function wrapWithDictLoad(obj, functName) { | ||
wrapWithDictLoad(nodejieba, "extract"); | ||
wrapWithDictLoad(nodejieba, "extractWithWords"); | ||
wrapWithDictLoad(nodejieba, "textRankExtract"); | ||
wrapWithDictLoad(nodejieba, "textRankExtractWithWords"); | ||
wrapWithDictLoad(nodejieba, "insertWord"); | ||
nodejieba.tagWordsToStr = function(words) { | ||
var result = ''; | ||
for (var i = 0; i < words.length; i++) { | ||
result += words[i].word + '/' + words[i].tag + ' '; | ||
} | ||
return result.trim(); | ||
}; | ||
module.exports = nodejieba; | ||
{ | ||
"name": "nodejieba", | ||
"description": "chinese word segmentation for node", | ||
"version": "2.2.7", | ||
"version": "2.3.0", | ||
"author": "Yanyi Wu <i@yanyiwu.com>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -27,3 +27,9 @@ var nodejieba = require("../index.js"); | ||
console.log(result); | ||
console.log('======='); | ||
console.log(nodejieba.extractWithWords(nodejieba.tagWordsToStr(result), 5)); | ||
console.log(nodejieba.extract(sentence, 5)); | ||
console.log(nodejieba.textRankExtractWithWords(nodejieba.tagWordsToStr(result), 5)); | ||
console.log(nodejieba.textRankExtract(sentence, 5)); | ||
console.log('======='); | ||
var topN = 5; | ||
@@ -41,1 +47,4 @@ result = nodejieba.extract(sentence, topN); | ||
console.log(result); | ||
@@ -8,5 +8,8 @@ declare module "nodejieba" { | ||
export function tag(sentence: string): any; | ||
export function extract(sentence: string, threshold: number): any; | ||
export function extract(sentence: string, threshold: number, allowedPOS?:string): any; | ||
export function insertWord(sentence: string): any; | ||
export function cutSmall(sentence: string, small: number): any; | ||
export function textRankExtract(sentence: string, threshold:number, allowedPOS?:string): any; | ||
export function extractWithWords(wordsStr:string, threshold:number, allowedPOS?:string): any; | ||
export function textRankExtractWithWords(wordsStr:string, threshold:number, allowedPOS?:string): any; | ||
} |
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
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
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
11758345
61
484