Skip to content

Instantly share code, notes, and snippets.

@EsteveSegura
Last active October 6, 2019 02:30
Show Gist options
  • Save EsteveSegura/c1ad050bd50a5f338a51176576c501de to your computer and use it in GitHub Desktop.
Save EsteveSegura/c1ad050bd50a5f338a51176576c501de to your computer and use it in GitHub Desktop.
markov
async function markovChain(){
let amazonDataSetFile = await utils.readFileLineByLine('../dataset/AmazonDataSet.txt')
let ourDataSet = await utils.readFileLineByLine('../dataset/sentences.txt')
let filteredData = amazonDataSetFile.filter((comments) => {
if(comments.includes("taste") || comments.includes("yummy") || comments.includes("good") || comments.includes("cooking") || comments.includes("delicious") || comments.includes("savory") || comments.includes("devour")){
return comments
}
})
filteredData = filteredData.slice(0,3500)
let bothDataSetsTogether = [...filteredData,...ourDataSet]
let markovChain = await markov.generate(bothDataSetsTogether,200);
return markovChain
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment