Socket
Book a DemoInstallSign in
Socket

@chatopera/node-ner

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

@chatopera/node-ner

NER with CRFSuite package.

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Intent

Sequence Labeler to train NER model with CRF++.

Usage

npm install @chatopera/node-ner
var intent = require("@chatopera/node-ner")

pos

Part of Speech

let tags = intent.pos(["i", "want", "a", "cab", "from", "kak", "to", "idap"]);
console.log("tokens ", tags);
tags = intent.pos("I want a cab from beijing to shanghai");
console.log("tokens ", tags);

tokenzie

Tokenizer

let tokens = intent.tokenzie("I want a cab from beijing to shanghai");
console.log("tokens ", tokens);

features

Extract features for sentence that can be used as input to train CRF model.

let input_xseq1 = intent.sen2features("I want a cab from beijing to shanghai");
console.log(input_xseq1)

train

Train models.

let curdir = __dirname;
let modelSavedPath = path.join(curdir, "tmp", "test.crf.book_cab.model");
let input_yseq1 = ["O", "O", "O", "O", "O", "B-from", "O", "B-destination"];
let samples = [
    [input_xseq1, input_yseq1],
    ... // add many as possible
];
let train = intent.train(samples, modelSavedPath);

predict

Predict entities in sentence with model.

let curdir = __dirname;
let modelSavedPath = path.join(curdir, "tmp", "test.crf.book_cab.model");
let sentence = "book a cab from York to DC."
let tags = intent.predict(featureExtractor.sen2features(sentence), modelSavedPath);
let tokens = intent.tokenzie(sentence);
let result = intent.extractEntities(tokens, tags);
console.log("extractEntities", result)
// extractEntities { from: 'york', destination: 'dc.' }

More examples: check out test/index.js.

Contribute

cd app/
npm install
DEBUG=intent* ava test/index.js

LICENSE

MIT

FAQs

Package last updated on 29 Jan 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.