For a project I need to process a generated text further, and I need it to replace words in the text with random words from a provided wordlist. I have already gotten it to pretty much do that, but in order to refine I would like it to sort the text into verbs and nouns, and then replace some nouns with random nouns from the word list, and some verbs with random verbs from the wordlist... you get the idea. At the moment it sometimes takes verbs and replaces nouns with them because it doesn't discriminate, which makes the text less understandable.
Here's the p5.js link to the sketch: https://editor.p5js.org/Nis/sketches/Jibt8tMKQ
Any thoughts?