You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

jieba-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jieba-js

jieba-js chinese word segmentation for node in pure javascript.

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
125
-6.72%
Maintainers
1
Weekly downloads
 
Created
Source

jieba-js

jieba-js A JavaScript Chinese word segmentation tool in pure javascript, based on Python Jieba

install

npm install jieba-js

demo

import jieba, { cut } from 'jieba-js';
const jieba = require("jieba-js");
const jieba = require("jieba-js").jieba;

//------------

const Jieba = require("jieba").Jieba;
const jieba = new Jieba();
console.log(jieba);

jieba.cut("我爸新学会了一项解决日常烦闷的活动,就是把以前的照片抱回办公室扫描保存,弄成电子版的。更无法接受的是,还居然放到网上来,时不时给我两张。\n这些积尘的化石居然突然重现,简直是招架不住。这个怀旧的阀门一旦打开,那就直到意识模糊都没停下来。")
	.then(function (ret)
	{
		//console.log(ret);
	})
;

cut('我的中文東西。', function (ret)
{
	//console.log(ret);
});

cut('我的中文東西。 2222222222').then(function (ret)
{
	console.log(ret);
});

Dict

this method only work before first time call jieba.cut or jieba.init

jieba.useDict('path of dict file')

let dict = [
    ['xxx', 0, 'x'],
];

jieba.useDict(dict)
  • hermanschaaf/jieba-js
  • pulipulichen/jieba-js

Keywords

analyzer

FAQs

Package last updated on 14 Mar 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.