ngramjs
v0.1.3
Published
String ngram splitter.
Downloads
322
Maintainers
Readme
Ngram.js
String ngram splitter.
This is a light weight open source package for the server and browser (using module bundler) written with TypeScript. The source code is available on GitHub where you can also find our issue tracker.
Installation
Run the command below to install the package.
npm install --save ngramjs
Example
The code below shows a basic usage example.
import { tokenize, ngram } from 'ngramjs';
tokenize("I like opensource!"); // => ["I", "like", "opensource"]
ngram('opensource', { style: 1, min: 3, max: 5 }); // => ['ope', 'open', 'opens']
ngram('opensource', { style: 2, min: 3, max: 5 }); // => ['ope', 'open', 'opens', 'pen', 'pens', 'penso', 'ens', 'enso', 'ensou']