Skip to content

Instantly share code, notes, and snippets.

@shrey150
Last active October 29, 2018 17:56
Show Gist options
  • Select an option

  • Save shrey150/4fcc3e4d3f34af678c31da47d29df395 to your computer and use it in GitHub Desktop.

Select an option

Save shrey150/4fcc3e4d3f34af678c31da47d29df395 to your computer and use it in GitHub Desktop.
Plagarizer
{
"name": "plagarizer",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Shrey Pandya",
"license": "MIT",
"dependencies": {
"datamuse": "^1.0.5"
}
}
const datamuse = require("datamuse");
const s = "The quick brown fox jumps over the lazy dog";
async function makeSentence() {
const arr = s.split(" ");
for (const rawWord of arr) {
const word = await getWord(rawWord);
console.log(word);
}
}
function shouldChangeWord() {
}
function getWord(word) {
return new Promise((resolve, reject) => {
datamuse.words({
ml: word
}).then(res => {
resolve(res[0]);
});
});
}
makeSentence();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment