Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including skipgram with all npm packages installed. Try it out:

var skipgram = require("skipgram")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

skipgram v1.0.2

For all your n-gram and skip-gram needs 🔠

skipgram

For all your n-gram and skip-gram needs 🔠

npm install -g skipgram
const skipgram = require('skipgram');
const text = '0 1 2 3 4 5 6 7 8 9';
skipgram(1)(text);
// [
//   [ '0' ],
//   [ '1' ],
//   [ '2' ],
//   [ '3' ],
//   [ '4' ],
//   [ '5' ],
//   [ '6' ],
//   [ '7' ],
//   [ '8' ],
//   [ '9' ]
// ]
skipgram(2)(text);
// [
//   [ '0', '1' ],
//   [ '1', '2' ],
//   [ '2', '3' ],
//   [ '3', '4' ],
//   [ '4', '5' ],
//   [ '5', '6' ],
//   [ '6', '7' ],
//   [ '7', '8' ],
//   [ '8', '9' ]
// ]
skipgram(4)(text);
// [
//   [ '0', '1', '2', '3' ],
//   [ '1', '2', '3', '4' ],
//   [ '2', '3', '4', '5' ],
//   [ '3', '4', '5', '6' ],
//   [ '4', '5', '6', '7' ],
//   [ '5', '6', '7', '8' ],
//   [ '6', '7', '8', '9' ]
// ]
skipgram(3, 1)(text);
// [
//   [ '0', '2', '4' ],
//   [ '1', '3', '5' ],
//   [ '2', '4', '6' ],
//   [ '3', '5', '7' ],
//   [ '4', '6', '8' ],
//   [ '5', '7', '9' ]
// ]

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free