GitHub - daspinola/speech-to-emotion: Convert speech into positive/neutral/negative reactions with Chrome and Node.js

link here: https://editor.p5js.org/cy1503/sketches/sAjYe7X6X

Initially

I worked on the example given in the GitHub.

I want to use the intensity of the text to represent the frequency of words. I created a variable called shade to map the count to be the color intensity and used span to put tokens together as a paragraph visually.

Screenshot 2024-09-29 at 23.05.49.png

Loading Issue

I was using the original example text file of Rainbow, and it took forever to load the result. I asked GPT on this question.

Screenshot 2024-09-29 at 23.17.59.png

And it suggested solutions below - which are very effective on the performance.

Screenshot 2024-09-29 at 23.18.57.png

Refinement

Though used “split(/\W+/)”, there were still numbers and numeric strings appearing. Then I added “isNaN(word)” and “!/\d/.test(word)” to ensure no numbers or numeric characters.

Screenshot 2024-09-29 at 22.58.27.png