You can still find the code, download it and try it for yourself.
A telegram bot that determines the polarity of a message using machine learning.
This bot was to created as a proof of work of the classifier trained in this Project, it will analyze the polarity of a given message, answering with either positive or negative, the confidence of the prediciton and the polarity, for precision purposes. It uses the Logistic Regression Classifier. It's always online powered by a Raspberry Pi so it will not be as fast as it would be if it was running on a powerful computer, to make up for this you will se the bot either typing...
or uploading photo...
. It can even be added to groups!
Here's a guide on getting started with the bot.
Clone the repository then install the requirements using this command:
$ pip3 install -r requirements.txt
You should have all the packages needed to run the bot. If that's not the case just run pip3 install package-name
Contact the BotFather in Telegram (@botfather) and create the bot, it's pretty striaghtforward, you will need the API Token so copy it and paste it the token.yaml
file inside the ""
:
You can then run the bot with this command:
$ python ./src/bot.py
These are the available commands:
/start
Starts the bot./predict
Analyze the incoming messages (default mode)./wordcloud
Create a WordCloud based on the incoming messages, better suited for longer paragraphs./cancel
Stops the bot.
If the bot will not reiceve messages within 1 minute it will go to sleep and notify the user.
Command: /predict
.
N.B. If you start the bot you dont'have to send the /predict
command because it's the default state, you will need to use it to switch between functions.
It will analyze the text the user sends, answering with a positive, mixed or negative result, a degree of certainty (if the bot isn't sure about the result it will tell the user) and the polarity, for improved precision. Since this project has been made for the italian situation of COVID-19, it will analyze ialian text only.
Command: /wordcloud
.
Great for longer paragraphs of text, it will output a WordCloud.
Distributed under the GPL License. See LICENSE
for more information.
Icons made by Smashicons from www.flaticon.com
Mattia Ricci - 285237