Skip to content

Instantly share code, notes, and snippets.

@bee-san
Created January 6, 2019 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bee-san/f886a806ea27d5e435de9c4e09563a8a to your computer and use it in GitHub Desktop.
Save bee-san/f886a806ea27d5e435de9c4e09563a8a to your computer and use it in GitHub Desktop.
function prettify(document){
// Turns an array of words into lowercase and removes stopwords
const stopwords = stopwords_array
// turn document into lowercase words, remove all stopwords
var document = document.replace(/[.,]/g, '');
let document_in_lowercase = document.split(" ").map(function(x){ return x.toLowerCase() });
return document_in_lowercase.filter( x => !stopwords.includes(x) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment