Initial planning for sentiment-chat
mari tang
Posted on May 5, 2019
Alright, I'm working on a fun side project now. I'll be blogging my way through the process and the design decisions that I'm making. This is part 1.
First off, here's what I want from the app.
It's an NLP/sentiment analysis driven chat app. Two people will be able to use the app to communicate. However, instead of receiving another person's words, users will receive a block of color, based off of the results of a sentiment analysis or NLP library.
For starters, I'm planning on using sentiment. It'll return a comparative score
, which is calculated by taking each word in a string, making a judgment on how positive/negative they are, and averaging all of those results to get a final score that lands somewhere between -5 (extremely negative) and 5 (extremely positive). It's only one number, but it's a floating point, so we'll be able to get a nice gradation of values along at least one axis.
Sentiment is supposed to be fairly fast, benching around 860k operations/sec on its creator's macbook pro. This should be essentially real-time for my usage.
Right now, I'm planning to implement sentiment as part of the client bundle, so users won't have to wait on network latency to see their colors. I'm imagining a flow that works something like this:
user input -> reducer (sentiment) -> state -> websockets connection -> chat partner (render it as color)
Today, I'm aiming to finish user input, reducer, state, and color-display functionality. I'll do websockets (or socket.io) next, then start work on finessing the UI/UX.
As far as the tech stack I'm on, it'll be React (with hooks) for the frontend, Node + Express for the backend, and userstorage to cache message history. At some point I might set up a database for chat history, but it doesn't matter that much for this kind of art-y project. Might be fun to export chat history as some kind of a gradient as well.
More to come in future posts.
Posted on May 5, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.