Introduction
Thirukkural, the timeless Tamil literary masterpiece by Thiruvalluvar, is revered for its wisdom and moral guidance. With the rise of digital tools, making Thirukkural more accessible to modern users is an exciting challenge. To bridge this gap, I have developed a Thirukkural Finding Bot, a Flask-based web application and API that allows users to search for Thirukkural verses, retrieve explanations, and even generate short stories based on the Kurals.
In this blog, I’ll walk you through the features, setup process, API functionalities, and how you can contribute or enhance this project.
Features of the Thirukkural Bot
This Flask-powered application offers the following functionalities:
- Search for Thirukkural by number or keyword (supports Tamil and English).
- Retrieve detailed explanations for each Kural.
- Generate short stories based on Kurals to make the wisdom more relatable.
- Provide API endpoints so developers can integrate Thirukkural data into their own applications.
- Simple and responsive web UI to facilitate easy access to Kurals.
- SQLite database integration for efficient data handling.
How to Set Up the Thirukkural Bot
If you’re interested in running this bot on your local system, follow these steps:
1. Clone the Repository
git clone https://github.com/praveen-manohar/thirukkural_chatbot.git
cd thirukkural_chatbot
2. Create a Virtual Environment
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
4. Set Up the Database
- Ensure you have
thirukkural_data.csv
in the project directory. - Run the Flask app to initialize the database:
python app.py
API Endpoints
This project provides a set of API endpoints that developers can use to fetch Thirukkural details programmatically:
1. Get a Kural by Number
Endpoint: GET /kural/<number>
Example: GET /kural/2
{
"kural_no": 2,
"kural_tamil": "கற்றதனால் ஆய பயனென்கொல்...",
"kural_english": "What profit hath learning..."
}
2. Search for Kurals by Keyword
Endpoint: GET /search?keyword=<query>
Example: GET /search?keyword=wisdom
[
{
"kural_no": 2,
"kural_tamil": "...",
"kural_english": "..."
}
]
3. Generate a Story for a Kural
Endpoint: GET /story/<number>
Example: GET /story/2
{
"story": "A wise man followed this Kural..."
}
Running the Web App
To start the Flask server and use the web app, run:
python app.py
Then open http://127.0.0.1:5000 in your browser.
Enhancing the UI
If you’re interested in improving the UI, you can modify:
templates/index.html
for the HTML structure.static/style.css
for styling and layout.
Why This Project Matters
The Thirukkural remains an invaluable literary treasure, offering life lessons that are still relevant today. By digitizing it and making it more accessible through a web app and API, this project aims to bridge traditional wisdom with modern technology.
Potential applications include:
- Educational tools for students and scholars.
- Chatbots and AI models that incorporate Thirukkural wisdom.
- Web integrations for Tamil literature websites and blogs.
Contributing to the Project
If you’re passionate about Tamil literature or Python development, feel free to contribute to this project. You can:
- Improve the UI and user experience.
- Add more API functionalities.
- Optimize database queries for better performance.
Fork the project on GitHub: Thirukkural Chatbot
Conclusion
Developing the Thirukkural Finding Bot was a rewarding experience, combining cultural heritage with modern-day programming. Whether you’re a developer, student, or literature enthusiast, I hope this project inspires you to explore new ways of preserving and sharing ancient knowledge through technology.