top of page

Sentiment Bouquet

Keywords: Javascript, P5.js, Sentiment Analysis, L-System...


<Sentiment Bouquet>        2022         Designed and documented by Xiangrui Zeng

Sentiment Bouquet generates digital flowers with text. I made a p5.js website where people can type in some text and they will get a bouquet showing on the screen. The color and shape of the flowers would vary based on the sentiment analysis of the text and I used L-System to design the growth of flowers. The purpose of this project is to make it a digital flowers sending website. As sometimes we want to send someone flowers but we can't physically do that because of distance or some other situations. On this website, I want the users to be able to generate flowers with what they want to say, so they can send someone digital flowers!

145753076-56981ffa-4278-469b-851c-6989c4d67dbe copy.png


First, I downloaded an AFINN library to calculate the sentiment scores. I also calculated the division result of the total score and the typed-in words length to get a comparative score of the whole sentence. Then I wrote an L-system grammar to generate the branches and flowers. The color of the flowers changes based on the comparative score. I made seven colors to match the score. A more positive score gives you pink and red flowers, and a more negative score generates more bluish flowers. The shape and the size of the flower are totally random.


Get your bouquet



bottom of page