Skip to content

TEJA3441/telugu-qa-generator

Repository files navigation

Telugu NLP Question-Answer Generator

A web application that generates Telugu question-answer pairs from input text using Python backend with FastAPI and Indic NLP library.

Features

  • Telugu Text Processing: Clean and normalize Telugu text input
  • Sentence Splitting: Uses Indic NLP library for accurate Telugu sentence segmentation
  • Rule-based Q&A Generation: Creates questions based on patterns like years, locations, and keywords
  • FastAPI Backend: RESTful API for text processing
  • Responsive Frontend: Clean web interface with Telugu language support
  • Input Validation: Validates Telugu text quality and length

Project Structure

.
├── app.py              # FastAPI backend server
├── telugu_processor.py # Core Telugu NLP processing logic
├── requirements.txt    # Python dependencies
├── index.html         # Frontend HTML
├── style.css          # Frontend styling
├── script.js          # Frontend JavaScript (API integration)
├── test_backend.py    # Backend testing script
└── todo.md            # Implementation progress

Setup Instructions

1. Install Python Dependencies

pip install -r requirements.txt

2. Start the Backend Server

python app.py

The server will start on http://localhost:8000

3. Open the Frontend

Open index.html in a web browser or use a local server:

# Using Python's built-in server
python -m http.server 8080

Then navigate to http://localhost:8080

API Endpoints

  • GET / - API information
  • GET /health - Health check
  • POST /generate - Generate Q&A pairs from Telugu text
  • POST /test - Test endpoint with sample text

Usage

  1. Enter Telugu text in the textarea (minimum 20 characters)
  2. Click "ప్రాసెస్ చేయి" (Process) button
  3. View generated question-answer pairs

Sample Input

తెలంగాణ రాష్ట్రం 2014 లో ఏర్పడింది. హైదరాబాద్ ఈ రాష్ట్ర రాజధాని. రాము ఒక మంచి విద్యార్థి.

Expected Output

1. Q: తెలంగాణ రాష్ట్రం ఏర్పడింది ఎప్పుడు?
   A: 2014

2. Q: తెలంగాణ రాష్ట్ర రాజధాని ఏది?
   A: హైదరాబాద్

3. Q: రాము ఒక మంచి గురించి ఏమిటి?
   A: రాము ఒక మంచి విద్యార్థి.

Testing

Run the backend test script:

python test_backend.py

Dependencies

  • FastAPI: Web framework for building APIs
  • Uvicorn: ASGI server for FastAPI
  • indic-nlp-library: NLP library for Indian languages
  • nltk: Natural Language Toolkit
  • pydantic: Data validation

Development Notes

  • The system uses rule-based approach for Q&A generation
  • Currently supports year-based and location-based question patterns
  • Can be extended with more sophisticated NLP models
  • Frontend communicates with backend via REST API

Future Enhancements

  • Add more question templates and patterns
  • Integrate machine learning models for better Q&A generation
  • Add user authentication and history
  • Support for multiple Indian languages
  • Export functionality for generated Q&A pairs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published