Building a Thirukkural Finding AI Bot with Flask and Python

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.

More Articles for You

How Artificial Intelligence Solved a 50-Year-Old Mystery of Life – Won a noble prize

Artificial intelligence (AI) is rapidly changing our world. It’s more than just clever chatbots or photo filters; it’s a powerful …

Open Wide: A 7-Step Digital Marketing Strategy for Your Dental Clinic in 2025

In the competitive landscape of Indian healthcare, a thriving dental practice in 2025 needs more than just clinical excellence. As …

Google I/O 2025: 5 AI Game-Changers Coming to Your Screens in India!

Google I/O 2025 just wrapped, and one thing is crystal clear: Artificial Intelligence is at the heart of everything Google …

Why Choose Open-Source Models for Coding in 2025?

Open-source large language models (LLMs) are reshaping the way developers code — from solo programmers to full-scale enterprises. If you’re …

The Best Open-Source AI Models for Coding in 2025

As a developer, having an AI-powered coding assistant can supercharge your workflow, from writing cleaner code to debugging complex issues. …

The Ultimate Guide to Off-Page SEO Techniques in 2025: Boost Your Rankings the Smart Way

Want your website to climb the Google rankings and attract more visitors? Off-page SEO is your secret weapon. Unlike on-page …