npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mathquis/crfsuite

v1.0.1

Published

NodeJS binding for CRFsuite

Downloads

5

Readme

node-crfsuite

A nodejs binding for crfsuite

MIT License npm version downloads Travis Appveyor

This is a link to the CRFSuite library written by Naoaki Okazaki. CRF or Conditional Random Fields are a class of statistical modeling method often applied in pattern recognition and machine learning and used for structured prediction.

Installation

For most "standard" use cases (on Mac, Linux, or Windows on a x86 or x64 processor), node-crfsuite will install easy with:

npm install crfsuite

API Usage

CRFSuite Tagger

const crfsuite = require('crfsuite')
const tagger = new crfsuite.Tagger()

let is_opened = tagger.open('./path/to/crf.model')
console.log('File model is opened:', is_opened)

let tags = tagger.tag(input)
console.log('Tags: ', tags)

CRFSuite Trainer

const path = require('path')
const crfsuite = require('crfsuite')
const trainer = new crfsuite.Trainer({
  debug: true
})

let model_filename = path.resolve('./model.crfsuite')

let xseq = [['walk'], ['walk', 'shop'], ['clean', 'shop']]
let yseq = ['sunny', 'sunny', 'rainy']

// submit training data to the trainer
trainer.append(xseq, yseq)
trainer.train(model_filename)

// output: ./model.crfsuite

Installation Special Cases

We use node-pre-gyp to compile and publish binaries of the library for most common use cases (Linux, Mac, Windows on standard processor platforms). If you have a special case, node-crfsuite will work, but it will compile the binary during the install. Compiling with nodejs is done via node-gyp which requires Python 2.x, so please ensure you have it installed and in your path for all operating systems. Python 3.x will not work.

Build from source

# clone the project
git clone --recursive https://github.com/vunb/node-crfsuite.git

# go to working folder
cd node-crfsuite

# install dependencies and build the binary
npm install

For development:

# rebuild
npm run build

# run unit-test
npm test

Change Log

2020-03-07: Release version 1.0.1

  • Add an options parameter to pass to a Trainer with a debug property to avoid writing logs to stdout. (17) (mathquis)
  • Update typescript declaration file

2019-07-18: Release version 1.0.0

  • Convert all sources to use N-API, remove nan
  • Add typescript declaration file
  • Cleanup package dependencies
  • CI Tool run & test only in node version 10 LTS
  • Add project convention: .gitattributes, .editorconfig
  • Enforced to use new keyword to create new Tagger and Trainer

2019-06-09: uses N-API

From [email protected] the library uses N-API to use the binary in multiple version of Node.

  • Acording to Node.js Foundation: With N-API, native module developers can compile their module once per platform and architecture, and make it available for any version of Node.js that implements N-API. This holds true even for versions of Node.js that are built with a different VM, e.g. Node-ChakraCore.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.