UNPKG

375 BJavaScriptView Raw
1/*eslint no-useless-escape: "off"*/
2
3/**
4 * Remove special characters and return an array of tokens (words).
5 * @param {string} input Input string
6 * @return {array} Array of tokens
7 */
8module.exports = function(input) {
9 return input
10 .toLowerCase()
11 .replace(/\n/g, ' ')
12 .replace(/[.,\/#!$%\^&\*;:{}=_`\"~()]/g, '')
13 .split(' ');
14};