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

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 …

Why “Revenue-Led SEO” Might Be Hurting Your Website (And What Works Instead)

SEO can feel like a mystery sometimes, right? You want your website to rank high on Google, bring in traffic, …

The Only SEO Strategy You Need in 2025: Rank Higher, Get More Traffic, Grow Faster

Introduction: SEO is the backbone of digital success. If you want your website to rank higher, attract more visitors, and …

SEO vs. Google Ads: Which One Delivers the Best ROI for Your Business?

SEO vs. Google Ads: Which One Delivers Better ROI? In the digital marketing world, businesses constantly debate between SEO (Search …

Top 15 SEO Challenges Every Digital Marketer Faces in 2025

Search Engine Optimization (SEO) is a constantly evolving field, and 2025 is no exception. With frequent algorithm updates, changing user …

⚡Work Smarter, Not Harder: The AI Tools Transforming Presentations

In today’s fast-paced digital landscape, Artificial Intelligence (AI) is transforming the way we create and deliver presentations. Gone are the …