xxxxxxxxxx
19
// Check out reference for Wordnik related words https://developer.wordnik.com/docs#!/word/getRelatedWords
let url1 = "https://api.wordnik.com/v4/word.json/";
let keyword = "equal";
let url2 ="/relatedWords?useCanonical=true&relationshipTypes=synonym&limitPerRelationshipType=10&api_key=";
let apiKey="wf635wa4dzxofw6g4zlbdn0hkv55g6px1ygvzrjd34f3to8q8"; // change this to your own key
function setup() {
createCanvas(400, 400);
background(185, 20, 222);
fill(255);
textSize(18);
loadJSON(url1+keyword+url2+apiKey, getData);
}
function getData(data){
print(data[0].words)
text(`${keyword} also means \n${data[0].words.join("\n")}`, 50, 50, 350, 350); // \n means new line
}