Created
January 6, 2019 14:48
-
-
Save bee-san/f886a806ea27d5e435de9c4e09563a8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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