Introduction

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.

  • Tweets to search: the number of tweets that we want to bring from the twitter API to be analyzed (10, 20, 50 or 100).
  • Username: the twitter user (@…) from which we will analyze the tweets.

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. 🤷‍♂️_

Image for post

Demo screenshot


Twitter API

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.

More info

Tensorflow.js

TensorFlow.js is a JavaScript library for training and implementing machine learning models in browsers and Node.js.

More info

Toxicity classifier Model

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.

More info

Image for post

#twitter #web-development #machine-learning #javascript #deep-learning

Twitter toxicity detector using Tensorflow.js
3.85 GEEK