How regnrok/autograder works
Project type and purpose
• This is a full‑stack web application (“Automatic Paper Checker”) whose goal is to let instructors upload scanned or photographed handwritten student papers alongside teacher answer sheets, run OCR + NLP + CV pipelines on the backend, then return text, sentiment, and similarity scores back to a React web UI.
• Key indicators: you have a React “frontend” directory with public + src, and a Python “backend” folder plus Jupyter notebooks for development. The README calls out Flask REST API, PyTesseract, OpenCV, spaCy, and NLTK.
File structure
• Top‑level Jupyter notebooks (Character_Recognition_Model.ipynb, Complete_Model.ipynb, etc.) capture your model development and testing stages.
• The “backend” folder holds the Flask app (App.py), OCR modules (recog.py), answer‑checker (checkanswer.py), and helper scripts.
• The “frontend” directory is a standard create‑react‑app scaffold: public/ holds index.html, manifest, static assets; src/ contains components, pages, assets, and main App.js, index.js.
• requirements.txt at the root defines Python dependencies; package.json under frontend lists Node deps.
README for additional insights
• The README spells out the four major processing stages: Image Preprocessing → OCR Extraction → NLP Analysis (sentiment + semantic similarity) → Result Generation.
• It confirms tech stack: React UI calls Flask REST endpoints; Flask code invokes PyTesseract, OpenCV, spaCy, and NLTK.
a. Main components:
• User’s Web Browser (UI)
• React Frontend
• Flask Backend (REST API)
• Image Preprocessing Module (OpenCV)
• OCR Module (PyTesseract)
• NLP Module (spaCy + NLTK)
• Jupyter Notebooks (dev environment—not part of runtime but can be shown as “development”)
• External Dependencies (Tesseract‑OCR engine, spaCy language model, NLTK lexicons)
b. Relationships & interactions:
1. User uploads files via React → HTTP POST multipart/form-data to Flask endpoint (/upload).
2. Backend receives images → passes to Preprocessing → outputs cleaned images.
3. Preprocessed images → OCR module → raw text output.
4. Raw text → NLP module:
• spaCy for tokenization + semantic similarity
• NLTK VADER for sentiment
5. Backend aggregates: extracted text, sentiment scores, similarity metrics → JSON response.
6. Frontend receives JSON → updates UI components (result panels, charts).
c. Architectural patterns/design principles:
• Three‑tier architecture: Presentation (React), Application (Flask), Data/Compute (CV + OCR + NLP modules).
• Single monolithic backend service (Flask) orchestrating sequential pipelines.
• Separation of concerns: React handles UI; Flask handles routing + business logic; dedicated Python modules encapsulate CV/OCR/NLP.
d. Technologies & libraries:
• Frontend: React, npm, create‑react‑app structure (public/, src/Components, src/Pages).
• Backend: Python 3.8+, Flask, modules in backend/*.py.
• OCR: PyTesseract + Tesseract‑OCR external binary.
• CV: OpenCV‑Python.
• NLP: spaCy (en_core_web_sm), NLTK (VADER).
• Dev/Testing: Jupyter notebooks for rapid prototyping.
Capturing essential architectural elements
• Keep it detailed enough so any new engineer can understand where image data enters, how it’s transformed, and where outputs appear.
• Avoid over‑simplification: separate OCR vs. NLP vs. CV even if they run in the same process.
• Future enhancement points (e.g., “add LMS integration here”).