This project is a Flask-based REST API and Web Application that allows users to search for Thirukkural verses, retrieve detailed explanations, and explore random Kurals. It supports both GET URL-based searches and POST JSON requests for flexibility in web and app integrations.
- 🔍 Search Thirukkural by number or keyword (Tamil & English support).
- 🎲 Fetch random Kurals with full explanations.
- 🌐 API endpoints for seamless integration with apps and websites.
- 💻 Web-based UI for direct searching and viewing Kurals.
- 🗄️ SQLite database backend for storing Kural data.
git clone https://github.com/your-repo/thirukkural-api.git
cd thirukkural-api
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
- Make sure you have
thirukkural_data.csv
in your project directory. - Run the Flask app once to initialize the SQLite database:
python app.py
Endpoint: GET or POST /api/chat
GET /api/chat?query=love
POST /api/chat
Content-Type: application/json
{
"query": "love"
}
{
"type": "search",
"query": "love",
"results": [
{
"kural_no": 80,
"kural_tamil": "அன்பும் அறனும் உடைத்தென்பர் ஆற்றின்...",
"kural_english": "They say love and virtue dwell together...",
"explanation_tamil": "...",
"explanation_english": "..."
}
]
}
Endpoint: GET /api/random
GET /api/random
{
"kural_no": 45,
"kural_tamil": "அறவாழி அந்தணன் தாள்சேர்ந்தார்...",
"kural_english": "Those who have reached the feet of the virtuous...",
"explanation_tamil": "...",
"explanation_english": "..."
}
You can also search and read Kurals through a simple web interface.
python app.py
http://127.0.0.1:5000
- HTML Templates:
templates/index.html
- CSS Styling:
static/style.css
You can customize these files to improve user experience.
Praveen Manoharan
Zerrowtech
- Fork this repository and create a pull request for improvements.
- Feel free to suggest additional features and report issues!
This project is licensed under the MIT License — free for personal and commercial use.
fetch('http://127.0.0.1:5000/api/chat?query=love')
.then(response => response.json())
.then(data => console.log(data));