Skip to content

seanghay/web-crfsuite

Repository files navigation

web-crfsuite

A port of crfsuite for Node, Browser & Deno

Usage

import CRFSuite from "web-crfsuite";

// training example
const trainer = new CRFSuite.Trainer();
const xseq = [['walk'], ['walk', 'shop'], ['clean', 'shop']];
const yseq = ['sunny', 'sunny', 'rainy'];

trainer.append(xseq, yseq);

// virtual file system
trainer.train("/model.crfsuite");

const buffer = FS.readFile("/model.crfsuite");

// tagging example
const tagger = new CRFSuite.Tagger();

// writing to the virtual file system
FS.writeFile("/model.crfsuite", buffer);

const result = tagger.tag(xseq);
// => [ 'sunny', 'sunny', 'rainy' ]

Building

Make sure you've Emscripten sdk install on your environment.

  1. Clone the project
git clone --recursive https://git@github.com:seanghay/web-crfsuite.git
  1. Compile & Build
npm install
npm run build

It will create a folder called build in the current directory with the output files.

References

Without these awesome projects from the community, this wouldn't be possible.