I have a sentence but this sentence was split for every space.
My datas output like this
const escapeRE = new RegExp(/([/\?""])/g);
const myDatas = data.map(des => des.Sentence.toLowerCase().replace(escapeRE, '').split(' '));
[ [ 'yes',
'keep',
'go',
'apple',
'tabacco',
'javascript',
'no',
'uhh',
'omg',
'hi.' ],
['say',
'hello',
'me',
'allright',
'maybe',
'mi',
'say.'
....] ]
And than i have a stop words JSON
file.
The contents of stop words JSON
file
['yes',
'hi',
'so',
'say',
'me',
'uhh',
'omg',
'go',
'hello',
'hi'
...]
So I want to remove stop words from array sentence.
I want pure sentence, without stop words.
stopwords
Defination;
const stopwords = require('./stop_words.json');
So what should I do ? I don't have any idea. I was try myDatas.replace('stopwords', '' )
function but it's useless
This is ES6 solitions
myDatas.map(des => des.filter(word => stopWords.indexOf(word) < 0));