compromise
Version:
natural language processing in the browser
21 lines (20 loc) • 369 B
JavaScript
;
//
const remove = (needle, ts) => {
let n = 0;
let matches = [];
let current = [];
ts.terms.forEach((term) => {
if (term === needle.terms[n]) {
if (current.length) {
matches.push(current);
current = [];
}
n += 1;
return;
}
current.push(term);
});
return matches;
};
module.exports = remove;