Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Hugo-ter-Doest/5099fd57abf512a1162248fb965d4d90 to your computer and use it in GitHub Desktop.
Save Hugo-ter-Doest/5099fd57abf512a1162248fb965d4d90 to your computer and use it in GitHub Desktop.
Natural: test of Skip ngrams
const _ = require("underscore")._;
const SkipNGrams = require('../lib/natural/ngrams/skip_ngrams');
const sentence = 'insurgents killed in ongoing fighting';
const two_skip_tri_grams = [
['insurgents', 'killed', 'in'],
['insurgents', 'killed', 'ongoing'],
['insurgents', 'killed', 'fighting'],
['insurgents', 'in', 'ongoing'],
['insurgents', 'in', 'fighting'],
['insurgents', 'ongoing', 'fighting'],
['killed', 'in', 'ongoing'],
['killed', 'in', 'fighting'],
['killed', 'ongoing', 'fighting'],
['in', 'ongoing', 'fighting']];
console.log(SkipNGrams.skip_ngrams(sentence, 3, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment