Inspiration 💡

Cyberbullying is a massive threat to mental health. Around 20-40% of all children have experienced cyberbullying of some form at least once in their lives. Cyberbullying can cause mental health issues, including low self-esteem, depression, and suicidal thoughts.

Though cyberbullying is recognized as a major issue, people don’t leverage this awareness to create better solutions. Most solutions our team found revolved around prevention, by spreading awareness to children about cyberbullying. This is a mediocre solution because spreading awareness about a problem is often extremely inefficient at solving said problem.

So what about intervention? Our team was shocked to find that most solutions in this area were mediocre as well. Developers in charge of chatrooms often use a blacklist, which is naive and easy to bypass. In order to solve this problem, developers often make the blacklist incredibly long, which is annoying to the user, or they make a whitelist, making the chatroom boring, monotonous, and hard to use.

We decided that machine learning, specifically natural language processing, is the best way to solve the problem. Using a bidirectional algorithm, not only can we take the entire context of a message when deciding whether it is derogatory or not, but we can also make it incredibly hard to bypass.

What it does ⚙️

Sir Lionheart is idle until its machine learning model detects that a message is derogatory. Then, the bot swiftly deletes the derogatory message and adds a warning under the author’s name. If the amount of warnings exceeds the maximum amount of warnings (set by the owner of the server using “?toggle”), the user is either banned or kicked (set by the owner of the server using “?toggle”).

How we built it 🛠️

Using Discord’s API for Python, we receive messages from the server we are in. Then, we send this message to our NLP model. This model uses fastText word embeddings and its classifier to classify words quickly. This classifier is trained on the dataset “Jibes and Delight”, a dataset containing comments on the subreddit “r/RoastMe”.

This classifier sends its result back to the Discord bot, which takes action if the message is declared derogatory (ignores the message if not). The bot deletes the message and adds a warning under the author’s name in our SQLite database. If the amount of warnings exceeds the tolerance set by the owner of the server, the user is either banned or kicked.

Challenges we ran into 😣

There weren’t many datasets that were provided for our cause. Though we found one in the end, finding the dataset took a long time. Another problem relating to the dataset was cleaning it for fastText. The fastText algorithm is extremely finicky about the way the dataset is fed, so cleaning it proved to be difficult.

The Discord bot was also difficult. We had to optimize the bot so that it could respond to messages quickly enough to make the message unreadable. We eventually optimized it enough by cutting out unnecessary code.

Accomplishments that we're proud of 🎉

We are proud of how we organized all of the different parts of the project in a timely manner. We are also proud of how we figured out to implement the Discord bot with a “Hello World” amount of experience with the Discord API.

What we learned 📚

We learned how to cooperate efficiently and use the Discord API to make fast and efficient Discord applications.

We also learned how to use the fastText library’s classifier, instead of hooking it up to one of Sci-kit Learn's or Keras'.

What's next for Sir Lionheart - Intervention of Cyberbullying with NLP ⏭️

If we had more time we would want to make different models for different levels of filtration. We would also want to give the owner more control over the bot, creating a blacklist for the bot, and giving the mod the ability to bypass the filtration.

Built With

Share this project:

Updates

Submission history