We often visit websites to convert our files into different formats and it is so usual these days especially for students studying through virtual classes that I don't need to explain why it is so important.
I have created a telegram bot (ofcourse most of us uses telegram!) that can be used to convert files to different formats and also to generate summary of a document.
You might be thinking I have created a bot from scratch. Not exactly, because you don't need to. The task is to assemble different APIs and make proper use of free deployment tools and libraries and most of your work is done. That is where you are bound to read the documentations of various APIs and libraries.
This telegram bot can provide the following functionalities:
Converting documents to PDF files.
Converting images to PDF files.
Summarizing/Sending the key sentences from a .txt file.
All the above Functionalities are added to the bot by making use of the required APIs and using the functionalities of telegram bot API, details of which are provided here: https://core.telegram.org/bots/
MAKING A SIMPLE TELEGRAM BOT
To begin with, I needed a pre-built bot which I can work on and add the necessary functionalities as per the requirements. The bot had to be such that it could run the functions defined upon sending a specific command from a set of commands. This is where BotFather comes into picture. In telegram, BotFather helps you create your own custom bot by writing a set of functions and integrating them in any language of your choice from the pool of languages, Telegram bots supports.
MAKING API CALLS
All the functionalities that the bot provides are indirectly provided by the APIs. We are using the result of the APIs and sending it in an appropriate format to the user without user knowing which API we have made call to. In this case, the convertapi is used, details of which are kept here: https://www.convertapi.com/doc/python-library
USING PYTHON LIBRARY FOR TEXT SUMMARIZATION
The function that sends the key sentences/summary from a .txt file makes use of a python library called sumy and it sends the key statements to us from the file. More details on the use of this library is provided here: https://pypi.org/project/sumy/
CONCLUSION
The bot is not limited to the functionalities which we discussed. We can add several other functionalities which can lead to enhancement of the features this bot provides like pdf to doc conversion, unzipping a zip file, merging 2 or more pdf and doc files and many others.
Link to the Github Repository: https://github.com/Crio-WFH/Telegram-bots/tree/main/PDF_Generation_and_Text_Summarization
For using the bot in telegram search for jk2000_bot in telegram.
Top comments (10)
Interesting.
Great work man!
Crio is expanding and is a great initiative.
Nice blog. Good use of APIs.
Great job!
Great Work!!!
Nice Work👍
Nice Work👍👍
Great work
Well done
Well Done!