Skip to content

matching ngram count

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Count matching n-grams between strings.

const matchingNgramCount = require('@extra-string/matching-ngram-count');
// matchingNgramCount(<string-1>, <string-2>, <n>)

matchingNgrams('worm', 'storm', 2);
// 2 ('or', 'rm')
matchingNgrams('astronaut', 'astronomer', 3);
// 4 ('ast', 'str', 'tro', 'ron')
matchingNgrams('coconut', 'cotton', 2);
// 2 ('co', 'on')

extra-string

Clone this wiki locally