In this post I want to show step by step how to build a web application that shows the last toxic tweets and retweets from the given user.
The application will receive 2 parameters: **tweets to search **and username.
The more tweets are analyzed, the more expensive the processing to predict toxicity becomes, so I added a selector to fetch 10, 20, 50 or 100 tweets (where 50 to 100 tweets imply a very high processing cost, reason why I don’t recommend to try it on low-performance computers or phone browsers).
As a result, it shows a list of the toxic tweets and retweets detected. You can access the live demo from here.
Note:_ Sometimes the Twitter API doesn’t get all the tweets on the first try, so you would probably need to press “SEARCH TWEETS” again. 🤷♂️_
Demo screenshot
The Twitter API allows us to programmatically access twitter content, it can be used to read, analyze and interact with tweets, direct messages, users, and other key Twitter resources.
TensorFlow.js is a JavaScript library for training and implementing machine learning models in browsers and Node.js.
The toxicity model is a tensorflow machine learning model that detects if the text contains toxic content such as insults, obscenities, hatred or explicitly sexual language. It’s built on top of the Universal Sentence Encoder and was trained on the civil comments dataset which contains ~2 million comments labeled for toxicity.
#twitter #web-development #machine-learning #javascript #deep-learning