| # How to Run: Tamil MCQ Generator |
|
|
| This guide explains the directory structure of the project and guides you through running the MCQ generator locally to test the model. |
|
|
| ## π Directory Structure |
|
|
| ```text |
| Quiz_MCQ_model/ |
| βββ data/ # Raw corpus and text data files |
| βββ models/ # Trained machine learning models (.bin fasttext model, Hugging Face models) |
| βββ nlp/ # Core NLP tools |
| β βββ ner_tagger.py # Hugging Face Named Entity Recognition |
| β βββ pos_tagger.py # Stanza POS Tagging |
| βββ preprocessing/ # Text sanitization pipeline |
| β βββ cleaner.py # Cleans texts of unwanted characters |
| β βββ data_loader.py # Loads zips and txt corpus files |
| β βββ process_pipeline.py # Orchestrates the validation and tokenization |
| β βββ tokenizer.py # Sentence and word tokenizers |
| βββ question_generation/ # The MCQ Logic |
| β βββ candidate_selector.py # Selects the best word to be the answer |
| β βββ domain_vocab.py # Pre-defined vocabularies by subject |
| β βββ option_generator.py # Uses FastText to generate wrong answers (distractors) |
| β βββ question_builder.py # Masks the answer to build the question |
| β βββ test_model.py # The MAIN script to run the pipeline |
| βββ prepare_corpus.py # Script to prepare the 'data/' folder |
| βββ tamil_mcq_clustering.py # Script to cluster words offline (HDBSCAN) |
| βββ train_fasttext.py # Script to train your own FastText embeddings |
| βββ requirements.txt # Python dependencies |
| βββ README.md # Project overview |
| βββ HOW_TO_RUN.md # This file |
| ``` |
|
|
| --- |
|
|
| ## π» Running the Model |
|
|
| ### Step 1: Install Dependencies |
| Open a terminal in the root directory and install the required Python packages: |
|
|
| ```bash |
| pip install -r requirements.txt |
| ``` |
|
|
| ### Step 2: Preparing the Offline Data (Optional) |
| *Note: If `models/tamil_fasttext.bin` and the cluster JSON files are already built and present, you can skip this step.* |
|
|
| If you need to train the model from scratch: |
| 1. Run `python prepare_corpus.py` to compile the corpus. |
| 2. Run `python train_fasttext.py` to create the word embeddings. |
| 3. Run `python tamil_mcq_clustering.py` to generate the word clusters. |
|
|
| ### Step 3: Checking the Model (The Main Entry Point) |
| To observe the MCQ Generation happening live on a sample Tamil text passage, you run the `test_model.py` script located in the `question_generation` folder. |
|
|
| Run the following command from the root directory: |
|
|
| ```bash |
| python question_generation/test_model.py |
| ``` |
|
|
| ### What to Expect: |
| When you run `test_model.py`, the code will pass a sample paragraph (e.g., about the Solar System) through the entire pipeline. |
| The terminal output will display: |
| - The original sentence. |
| - The formatted MCQ sentence with the blank "_____". |
| - 4 generated options (including the correct answer and 3 smart distractors). |
| - The correct answer extracted below. |
| |