Security News
Python Overtakes JavaScript as Top Programming Language on GitHub
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
NodeJieba
只是CppJieba简单包装而成的node
扩展,用来进行中文分词。
npm install nodejieba
因为npm
速度很慢而且经常因为墙的原因出现莫名其妙的问题,在此强烈建议使用cnpm,命令如下:
npm --registry=http://r.cnpmjs.org install nodejieba
var segment = require("nodejieba");
segment.loadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");
var wordList = segment.cutSync("阻塞模式分词");
if (wordList.constructor == Array) // just for tutorial, this is always be true
{
wordList.forEach(function(word) {
console.log(word);
});
}
segment.cut("非阻塞模式分词", function(wordList) {
wordList.forEach(function(word) {
console.log(word);
});
});
var segment = require("nodejieba");
segment.queryLoadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");
var wordList = segment.queryCutSync("阻塞模式分词");
if (wordList.constructor == Array) // just for tutorial, this is always be true
{
wordList.forEach(function(word) {
console.log(word);
});
}
segment.queryCut("非阻塞模式分词", function(wordList) {
wordList.forEach(function(word) {
console.log(word);
});
});
具体用法可以参考 test/segment.js test/query_segment.js
在node v0.10.2
下测试通过
http://cppjieba-webdemo.herokuapp.com/ (chrome is suggested)
v0.2.1
queryLoadDict, queryCutSync, queryCut
。FAQs
chinese word segmentation for node
The npm package nodejieba receives a total of 9,818 weekly downloads. As such, nodejieba popularity was classified as popular.
We found that nodejieba demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
Security News
Dutch National Police and FBI dismantle Redline and Meta infostealer malware-as-a-service operations in Operation Magnus, seizing servers and source code.
Research
Security News
Socket is tracking a new trend where malicious actors are now exploiting the popularity of LLM research to spread malware through seemingly useful open source packages.