A full-stack AI-powered learning platform for NCERT textbooks, built as a mini project for NLP evaluation. Upload any NCERT PDF (English or Hindi), and the platform automatically extracts chapters, runs a complete NLP pipeline, and powers an interactive learning dashboard.
This platform combines classical NLP techniques with modern language models to create an end-to-end educational tool for Indian school students. The backend processes NCERT PDFs through a multi-stage NLP pipeline and exposes a REST API consumed by a React dashboard.
| Feature | Description | NLP Technique |
|---|---|---|
| π€ PDF Upload | Upload full textbooks or chapter-wise PDFs | PyMuPDF + Tesseract OCR |
| π Hybrid Summarizer | Chapter summaries in English, Hindi, Marathi | MBart-50 + Extractive NLP |
| π Difficult Words | Vocabulary detection with definitions & translations | NLTK POS tagging + WordNet |
| βοΈ Word Cloud | Concept-weighted visual map of chapter themes | TF-IDF + Noun phrase extraction |
| π¬ Chapter NLP Analysis | Named entities, topics, and key concepts | spaCy NER + LDA Topic Modeling |
| π― Quiz Generator | MCQ, True/False, Fill-in-blanks, Multi-select | NLP pipeline + Gemini 2.5 Flash |
| πΊ Recommendations | Educational video links matched to chapter concepts | Concept extraction + YouTube API |
| π¬ RAG Chat | Ask questions grounded in NCERT chapter text | FAISS + RoBERTa QA model |
| π Semantic Search | Find relevant passages across chapters | Sentence Transformers + FAISS |
NCERT PDF
β
βββββββββββββββββββββββββββββββββββββββββββ
β Document Processing β
β PyMuPDF extraction β OCR fallback β
β Chapter detection β Text cleaning β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β NLP Pipeline β
β Language detection (Devanagari ratio) β
β Tokenization β Sentence segmentation β
β TF-IDF keywords β spaCy NER β
β LDA topic modeling β Concept extract β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β Vector Store (FAISS) β
β Sentence-BERT embeddings β
β Cosine similarity search β
β Overlapping chunk retrieval β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β FastAPI REST Backend β
β SQLite + SQLAlchemy async ORM β
β Async endpoints with uvicorn β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β React Frontend β
β Vite + React 18 dashboard β
β 11-section learning interface β
βββββββββββββββββββββββββββββββββββββββββββ
- Unicode normalization and PDF artifact removal
- Language detection via Devanagari character ratio analysis
- Sentence segmentation using NLTK
sent_tokenize - Word tokenization with NLTK and spaCy
- TF-IDF (
scikit-learn TfidfVectorizer) for high-importance term extraction - Noun phrase chunking using spaCy dependency parsing
- Named Entity Recognition with spaCy
en_core_web_smmodel - LDA Topic Modeling (
sklearn LatentDirichletAllocation) for thematic clustering
- Extractive summarization for English: sentence ranking by TF-IDF keyword density
- Abstractive summarization for Hindi: fine-tuned MBart-50 multilingual model
- Language-aware routing: detects source language and selects appropriate pipeline
- Sentence embeddings:
all-MiniLM-L6-v2viasentence-transformers - Vector indexing: FAISS
IndexFlatIP(inner product = cosine similarity on normalized vectors) - Overlapping chunking: 5-sentence chunks with 1-sentence overlap for context continuity
- Extractive QA:
deepset/roberta-base-squad2for answer span extraction
- NLP pipeline extracts key concepts, entities, and important sentences
- Gemini 2.5 Flash formats these into structured exam questions
- JSON validation and sanitization ensures well-formed question objects
- POS tagging with NLTK averaged perceptron tagger
- Syllable complexity scoring for difficulty ranking
- WordNet synset lookup for definitions, synonyms, and examples
- Translation enrichment: Hindi and Marathi meanings via Groq
| Layer | Technology |
|---|---|
| Framework | FastAPI 0.111 + Uvicorn |
| Database | SQLite + SQLAlchemy 2.0 (async) |
| PDF Processing | PyMuPDF, pdfplumber |
| OCR | Tesseract + pytesseract |
| Core NLP | NLTK 3.8, spaCy 3.8 |
| ML / Embeddings | scikit-learn, sentence-transformers |
| Vector Search | FAISS CPU |
| Transformers | HuggingFace Transformers, PyTorch |
| Summarization | MBart-50 (fine-tuned Hindi) |
| QA Model | deepset/roberta-base-squad2 |
| Quiz Generation | Gemini 2.5 Flash (google-genai) |
| Vocabulary AI | Groq (Hindi meanings) |
| Layer | Technology |
|---|---|
| Framework | React 18 + Vite |
| Routing | React Router v6 |
| Charts | Recharts |
| Animations | Framer Motion |
| API Client | Fetch API (custom client) |
ncert/
βββ backend/
β βββ main.py # FastAPI app entry point
β βββ requirements.txt
β βββ .env # API keys
β βββ database/
β β βββ database.py # SQLAlchemy async engine
β β βββ models.py # Book, Chapter ORM models
β βββ api/
β β βββ books.py # Book CRUD endpoints
β β βββ upload.py # PDF upload endpoints
β β βββ nlp.py # All NLP feature endpoints
β β βββ search.py # Semantic search endpoint
β βββ nlp_engine/
β βββ pipeline.py # Text analysis pipeline
β βββ preprocessing/
β β βββ cleaner.py # Text cleaning
β β βββ tokenizer.py # Sentence/word tokenization
β β βββ language.py # Language detection
β βββ document/
β β βββ processor.py # PDF processing orchestrator
β β βββ pdf_extractor.py # PyMuPDF text extraction
β β βββ ocr.py # Tesseract OCR fallback
β β βββ chapter_detector.py # Chapter boundary detection
β β βββ database_saver.py # Persist processed chapters
β βββ analysis/
β β βββ keywords.py # TF-IDF keyword extraction
β β βββ concepts.py # Noun phrase / concept mining
β β βββ entities.py # spaCy NER
β β βββ topics.py # LDA topic modeling
β β βββ vocabulary.py # Difficult word detection
β β βββ summarizer.py # Extractive summarization
β β βββ recommendations.py # Video recommendations
β β βββ similarity.py # TF-IDF + semantic similarity
β β βββ wordcloud_generator.py # Word cloud generation
β βββ generation/
β β βββ hindi_summarizer.py # MBart-50 Hindi summarizer
β β βββ summarizer.py # Summarizer module router
β β βββ quiz_generator.py # Gemini quiz generation
β β βββ question_generator.py # T5 question generation
β β βββ answer_generator.py # RoBERTa QA + translation
β βββ retrieval/
β βββ embeddings.py # Sentence-BERT embeddings
β βββ chunking.py # Overlapping text chunking
β βββ vector_store.py # FAISS vector index
β βββ chapter_retriever.py # Build chapter FAISS store
βββ frontend/
βββ src/
βββ api/
β βββ Client.js # API client
βββ components/
βββ ncert/
βββ NcertDashboard.jsx
βββ Sidebar.jsx
βββ UploadSection.jsx
βββ OverviewSection.jsx
βββ SummarySection.jsx
βββ DifficultWordsSection.jsx
βββ KeywordsSection.jsx
βββ ChapterAnalysisSection.jsx
βββ QuizSection.jsx
βββ RecommendationsSection.jsx
βββ ChatSection.jsx
βββ SemanticSearchSection.jsx
βββ ChaptersSection.jsx
- Python 3.10
- Node.js 18+
- Tesseract OCR (install with Hindi language data)
- A free Gemini API key
- A free Groq API key (for Hindi vocabulary)
# 1. Clone the repository
git clone https://github.com/sakship2005/ncert.git
cd ncert/backend
# 2. Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux
# 3. Install dependencies
pip install -r requirements.txt
pip install pytesseract pillow google-genai
# 4. Download NLP models
python -m spacy download en_core_web_sm
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('averaged_perceptron_tagger')"
# 5. Create .env fileCreate backend/.env:
GEMINI_API_KEY=your_gemini_api_key_here
GROQ_API_KEY=your_groq_api_key_here
GROQ_MODEL=llama-3.3-70b-versatile# 6. Run the backend
uvicorn main:app --reload --port 8000Backend runs at http://localhost:8000
Swagger docs at http://localhost:8000/docs
cd ../frontend
# Install dependencies
npm install
# Run development server
npm run devFrontend runs at http://localhost:5173
| Method | Endpoint | Description |
|---|---|---|
GET |
/books |
List all uploaded textbooks |
POST |
/books/create |
Create a book entry |
POST |
/books/upload/full |
Upload a full textbook PDF |
POST |
/books/upload/chapter |
Upload a single chapter PDF |
GET |
/books/{book_id}/chapters |
List chapters for a book |
POST |
/nlp/summarize |
Generate chapter summary |
POST |
/nlp/difficult-words |
Extract vocabulary |
POST |
/nlp/chapter-analysis |
NER + topics + concepts |
POST |
/nlp/generate-quiz |
Generate interactive quiz |
POST |
/nlp/recommendations |
Educational resource recommendations |
POST |
/nlp/ask |
RAG question answering |
POST |
/search |
Semantic search across chunks |
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
β Yes | Google AI Studio key for quiz generation |
GROQ_API_KEY |
Groq key for Hindi vocabulary meanings | |
GROQ_MODEL |
Groq model name (default: llama-3.3-70b-versatile) |