← All work

05 · NLP · DEPLOYMENT

Grammar & Spell Checker

Repository codename · NLP Correction App

A Flask application that repairs grammar and spelling using transformer models, containerised so the model environment behaves identically on every machine it lands on.

Role
Build + containerisation
Core stack
Flask · Transformers · Torch
Spelling
TextBlob
Deployment
Docker
2correction layers
1command to deploy
3.10Python version pinned

01 — THE PROBLEM

Rule-based spell checkers fix typos but cannot see that a sentence is ungrammatical. Language models fix grammar but are heavy and fussy to install — and the usual outcome is a project that works on the machine it was written on and nowhere else.

This project pairs both approaches, then removes the environment problem entirely by shipping the whole thing as an image.

02 — ARCHITECTURE

Input text → TextBlob (spelling) → Transformer model (grammar) → Corrected output
                                ↑
                      Torch backend, inside Docker

03 — BUILD LOG

The decisions that shaped the system, and why each one was made.

  1. Two layers, because they fail differently

    TextBlob handles spelling, where a dictionary is exactly the right tool. A Hugging Face transformer running on Torch handles grammar, where context is required. Each one covers the other's blind spot, instead of asking a single component to do everything.

  2. Docker as the actual feature

    A Dockerfile pins Python 3.10 and the full model environment, so docker run is the entire install procedure. For an NLP app with Torch in the dependency tree, reproducibility is not a nicety — it is the difference between a usable project and a README full of caveats.

  3. A swappable model

    The correction model sits behind Model.py rather than being inlined into the Flask routes, so it can be exchanged or fine-tuned for domain-specific grammar rules without touching the web layer.

  4. Honest about production

    Debug mode is enabled for development only, and the developer notes call for Gunicorn or uWSGI in front of the app before it faces real traffic — documented rather than silently shipped as-is.

04 — WALKTHROUGH

Running it end to end.

● Live Try it live ↗ Running on Hugging Face Spaces. Docker is a paid SDK there, so the public demo is a Gradio interface over the same model; the Flask app and its Dockerfile still run locally.
  1. Build the image

    docker build -t grammar-spell-checker .
  2. Run the container

    docker run -p 5000:5000 grammar-spell-checker
  3. Open it

    http://localhost:5000
  4. Try the sample

    A single sentence carrying four separate errors — verb agreement, a double negative, a countability mistake and tense.

    Input:
      He dont has no idea how many informations
      was missing from the report.
    
    Output:
      He doesn't have any idea how much information
      was missing from the report.

05 — STACK

Python 3.10FlaskHugging FaceTransformersTorchTextBlobDocker
Read the source on GitHub ↗