Link to the p5.js sketch: https://editor.p5js.org/kh1785/sketches/vLZgle-UI
Queer Poem Generator is a p5.js sketch that generates random poems out of the given text. I used an excerpt from Queer, the novel by William Burroughs, as a source text.
Poem Example
The sketch will generate five random sentences only with the words found in the source text. I mainly used RiTa library to set any necessary rules and to process the text. Despite the randomness in the output words, all the sentences will have the same sentence structure as determined by the variable "speech" at the beginning of the sketch. The acronyms such as 'nns', 'md', or 'jj' are the tags representing each part of speech according to the PENN part-of-speech tags.
The below function is used to create a set of random words. It will look for all the words that belong to the given tag input and will return to one random word in the set.
Comments