Check the number of words overlapping between 2 phrases or sentences
Used in cases to check whether 2 titles / sentences / phrases are referring to the same context. E.g. 2 event names.
npm install word-overlap
// in main.jsvar overlap = ;var sentence1 = 'The Hitchhikings Meetup in Betelgeuse by Ford Prefect';var sentence2 = 'The hitchhikings meetups by the hitchhikers';var reply =;console;
make the file
browserify main.js -o build.js --exclude WNdb --exclude lapack
var overlap = ;var sentence1 = 'The Hitchhikings Meetup in Betelgeuse by Ford Prefect';var sentence2 = 'The hitchhikings meetups by the hitchhikers';
;// [ 'The', 'by' ]
;// [ 'the', 'hitchhikings', 'by' ]
;// [ 'the', 'hitchhiking', 'by' ]
Common words by default include: a, an, the, this, that, there, it, in, on, for, not, your, you, at, to, is, us, out, by, I
;// [ 'hitchhikings' ]
Ignore numbers such as: 5e3, 0xff, -1.1, 0, 1, 1.1, 10, 10.10, 100, '-1.1', etc.
sentence1 = 'Welcome to 2015';sentence2 = '2015 Meetup for the year';console;// [ ]
;// [ ]
;// [ 'hitchhiking', 'meetup' ]
;// [ 'hitchhikings', 'meetup' ]
var sentence1 = 'A programming course in SmallTalk';var sentence2 = 'Have you programmed in SmallTalk?';;// [ 'program', 'smalltalk' ]
Try out the examples in file
example.js with the command
CONTRIBUTING.md for details.
This repository follows the Semantic Versioning guidelines:
(C) Sayanee Basu 2014, released under an MIT license