Skip to content

Repository files navigation

✨ AI Grammar Studio

Private, offline-first intelligent writing, translation & content intelligence studio powered by local on-device AI.

React TypeScript Electron Vite ONNX Runtime DirectML Meta NLLB-200 License: GPL-3.0


Features β€’ Supported Models β€’ Architecture β€’ Getting Started β€’ Build & Packaging β€’ Tech Stack β€’ License


πŸ“– Overview

AI Grammar Studio is a modern desktop writing environment designed from the ground up for absolute privacy and zero data leakage. Unlike traditional writing tools that transmit your sensitive keystrokes, corporate memos, or creative drafts to cloud servers, AI Grammar Studio executes 100% of its spell check, grammar correction, style enhancement, multi-lingual neural translation, AI content detection, plagiarism auditing, and syntactic parsing locally on your machine.

Whether running on a discrete GPU with Microsoft DirectML acceleration or an ultra-low-power CPU, AI Grammar Studio delivers private, low-latency, and unconstrained writing intelligence.


πŸš€ Key Features

πŸ–₯️ Modern Studio Dashboard & Command Hub

  • Quick-Start Launcher Strip: Interactive instant-action banner to jump straight into the Grammar Editor or paste text from the clipboard with 1-click.
  • Structured Workflow Grids: Clean separation into Writing & Language Studios (Grammar & Style Editor, Creative Writing, Neural Translation) and Linguistics, Auditing & Preferences (Deep Linguistic Analysis, AI & Plagiarism Detector, Models & Hardware).
  • Live System Telemetry & Health Bar: Real-time indicators displaying 100% on-device privacy status, active grammar engine (dynamically resolved to the active model name or heuristic rules), compute backend (AMD DirectML, NVIDIA CUDA, Intel DirectML, or CPU), and App Info shortcuts.

⚑ Dual Grammar & Style Processing Engines

  • Instant Heuristic Engine: Sub-millisecond rule-based spelling correction (NSpell + Hunspell), readability scoring (Flesch-Kincaid), clichΓ© detection, passive voice warnings, homophone & preposition alignment, double negative & comma splice fixes, and persistent custom user dictionaries.
  • Deep Neural Engine: Local Seq2Seq neural models running directly on your CPU or GPU via ONNX Runtime to perform context-aware grammatical restructuring and stylistic polishing.

🌐 100% Offline Neural Translation Studio (Meta NLLB-200)

  • 200+ Global Languages: Powered by Meta's NLLB-200 Distilled (600M Q4 Quantized) (Xenova/nllb-200-distilled-600M), enabling high-fidelity multilingual translation completely offline with zero external API calls or subscription keys.
  • Dual-Pane Split Workbench: Source and target workbenches featuring live character/word counters, sample text loader, keyboard shortcuts (Ctrl + Enter / Cmd + Enter), and fast copy actions.
  • Searchable Language Selector: Quick-pick pills for top languages (English, Spanish, French, German, Hindi) plus a searchable dropdown supporting 35+ major languages with localized native names.
  • 1-Click Editor Integration: Seamlessly transfer translated text directly into the main Grammar Studio workspace via the "Open in Editor" action.
  • Dynamic AI Status Pill: Reactive indicator displaying ⚑ Local AI Online or ⚠ Local AI Offline with dedicated model management in Settings.

πŸ›‘οΈ Plagiarism & AI Content Detector Suite

  • Statistical NLP AI Detection: Evaluates word entropy, average perplexity, and sentence/document-level burstiness index (sentence length variation) with 100% offline privacy.
  • Local Neural Classifier Ensemble: Integrates quantized neural classification models (including ModernBERT RAID AI Detector, TMR AI Text Detector, and RoBERTa OpenAI Detector) for hybrid ensemble scoring that detects text generated by GPT-4o, Claude 3.5, Gemini, and Llama 3.
  • Dual-Mode Plagiarism Scanner:
    • 100% Offline Mode: Detects internal structural self-duplication and includes a Local Reference Document Comparator using N-Gram Containment Measurement to cross-verify text against local files (.txt, .md, .docx).
    • Online Web Mode (Toggleable): Extracts semantic n-gram shingles to scan public search indexes and the Wikipedia Open Search API with in-memory LRU caching, deduplication, and lightweight payload guards.
  • Interactive Sentence Heatmap: Visual color-coded highlighting (Human, Mixed, Likely AI, Heavy AI) with click-to-inspect sentence inspection cards.
  • Enterprise Audit Report Generator: Official Certificate of Originality & AI Content Verification Report featuring verification IDs, document timestamps, visual score dials, and 1-click PDF Export (via Electron native printToPDF()), HTML Export, JSON clipboard export, and direct printing.

🎨 Creative Studio & Prompt Lab

  • Multi-Style Tone Rewriting: Dynamically adapt text across 7 distinct writing modes:
    • Academic β€’ Professional β€’ Casual β€’ Concise β€’ Creative β€’ Confident β€’ Friendly
  • Streaming Local LLM Generation: Real-time token streaming powered by modern open-weights instruction models (Qwen 3, Gemma 3, Llama 3.2, Qwen 2.5) with <think> reasoning support.

πŸ”¬ Deep Linguistic Analysis

  • Voice Transformation: Automated conversion between Active Voice and Passive Voice with agentless passive handling and stative verb validation.
  • Narration Conversion: Intelligent transformation between Direct Speech and Indirect Speech with pronoun backshifting, modal shifts, and exclamatory assertions.
  • Degrees of Comparison: Transform adjectives seamlessly across Positive, Comparative, and Superlative degrees.
  • Clause Breakdown: Classify sentences into Main clauses, Subordinate clauses, and Relative clauses.
  • Tense & Timeline Mapping: Detect grammatical tense formulas and position verb phrases chronologically.
  • Parts of Speech (POS): Color-coded tokenized syntax breakdown visualizer.

⚑ Precision GPU Hardware Detection & Acceleration

  • Native WMI/CIM Hardware Queries: Directly queries physical GPU hardware in the Electron main process to capture GPU model names, dedicated VRAM capacity (e.g. Radeon RX 570 Series (4 GB VRAM)), and driver information.
  • Virtual Display Adapter Filtering: Automatically ignores software and virtual adapters (e.g., Parsec, RDP, Basic Display).
  • Intelligent Compute Backend Selection: Glassmorphic hardware banner in Settings displaying detected GPU chips, dedicated VRAM badges, vendor acceleration tags (AMD DirectML, NVIDIA CUDA, Intel DirectML), and safe fallback confirmation modals.

πŸͺŸ Modernized Desktop Experience

  • Frameless Custom Themed TitleBar: Native window dragging, dynamic page breadcrumbs with Lucide icons, live engine status indicator (⚑ Local AI Ready / ✨ Fast Heuristic Engine), custom window controls, and quick theme toggle (Dark #05070d & Light #f8f9fa).
  • Multi-Metric Bottom Status Bar: Live word count, character count, estimated reading time, suggestion count badge, and glowing model status light.
  • Custom Glassmorphic Modals: High-fidelity confirmation dialogs for model deletion, downloads, and fallback notices.

🧠 Supported On-Device Models

All models run 100% locally on your device through @xenova/transformers and onnxruntime-node with Q4/int8 quantization for low RAM/VRAM footprint:

Category Model Name Hugging Face Repository Parameters Size Specialty
Grammar Gec-T5 Small JonaWhisper/jonawhisper-gec-t5-small-onnx 80M ~120 MB Ultra-fast, lightweight grammar correction
Grammar Flan-T5 Base onnx-community/t5-base-grammar-correction-ONNX 250M ~350 MB Purpose-built grammar refinement
Grammar Flan-T5 Large Xenova/LaMini-Flan-T5-783M 783M ~850 MB Deep instruction-following & structural edits
Grammar CoEdIT Large imrahamed/coedit-large-webgpu-onnx 783M ~3.2 GB Grammarly's state-of-the-art text-editing model
Creative Qwen 3 onnx-community/Qwen3-0.6B-ONNX 0.6B ~877 MB Fast creative generation & <think> reasoning
Creative Gemma 3 onnx-community/gemma-3-1b-it-ONNX 1.0B ~860 MB Google's compact instruction-tuned model
Creative Llama 3.2 onnx-community/Llama-3.2-1B-Instruct-ONNX 1.2B ~1.6 GB Meta's high-reasoning writing assistant
Creative Qwen 2.5 onnx-community/Qwen2.5-1.5B-Instruct 1.5B ~900 MB Coherent text generation & tone rewriting
Creative Qwen 3 onnx-community/Qwen3-1.7B-ONNX 1.7B ~1.4 GB Advanced creative writing & <think> reasoning
Detector ModernBERT RAID AI Detector onnx-community/modernbert-ai-detection-raid-mage-ONNX 149M ~144 MB SOTA detection for GPT-4o, Claude 3.5, Gemini, Llama 3
Detector TMR AI Text Detector onnx-community/tmr-ai-text-detector-ONNX 125M ~125 MB Neural AI text classifier
Detector RoBERTa OpenAI Detector onnx-community/roberta-base-openai-detector-ONNX 125M ~125 MB Fine-tuned OpenAI classifier
Translation Meta NLLB-200 Xenova/nllb-200-distilled-600M 600M ~875 MB 100% offline translation across 200+ global languages

πŸ— Architecture

graph TD
    UI[Renderer Process - React 19 + Vite] -->|IPC Invocation| Main[Electron Main Process]
    Main -->|Instant Checks| Quick[QuickGrammarEngine - Heuristics, NSpell, Style Rules]
    Main -->|Plagiarism & NLP Checks| Detector[DetectorEngine - Perplexity, Burstiness, Online Shingles]
    Main -->|Hardware Query| Hardware[Hardware Detection - WMI / CIM GPU & DirectML]
    Main -->|Post Message| Worker[Dedicated AI Worker Thread]
    Worker -->|ONNX Runtime / DirectML| Models[Local ONNX Model Cache]
    Worker -->|Stream Chunks| Main
    Main -->|IPC Events| UI
    Main -->|Export PDF / HTML| Report[Audit Report Generator]
    Main -->|Storage| LocalData[(Local Settings & Dictionary Store)]
Loading

πŸ’» Getting Started

Prerequisites

  • Node.js: v18.0.0 or higher
  • npm: v9.0.0 or higher
  • OS: Windows 10/11 (x64)

Installation

  1. Clone the repository:

    git clone https://github.com/sayandey021/AI-Grammar-Studio.git
    cd AI-Grammar-Studio
  2. Install dependencies:

    npm install
  3. Start in Development Mode:

    npm run dev

    This starts the Vite React development server with Hot Module Replacement (HMR), compiles the TypeScript main process, and launches the Electron desktop shell.


πŸ“¦ Build & Packaging

AI Grammar Studio includes automated Windows build scripts located in the scripts/ directory:

Script Command Description
scripts/build_all.bat npm run build:all Compiles frontend/backend and creates both .EXE and .MSIX in dist/.
scripts/build_exe.bat npm run build:exe Generates a standalone NSIS Windows Installer (.exe).
scripts/build_msix.bat npm run build:msix Generates a signed Windows Store Package (.msix / .appx).
scripts/change_version.bat npm run set-version Interactively updates version numbers across package.json and manifests.
scripts/generate-icons.ps1 β€” PowerShell script to generate all AppX / MSIX tile logo asset scales.

πŸ“ Repository Structure

β”œβ”€β”€ .github/                  # GitHub Actions CI, issue templates & PR guidelines
β”œβ”€β”€ assets/                   # Application icons & visual branding assets
β”œβ”€β”€ build/                    # AppX / MSIX packaging resources and tile logos
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ build_all.bat         # Unified build script (.EXE + .MSIX)
β”‚   β”œβ”€β”€ build_exe.bat         # Standalone Windows NSIS installer builder
β”‚   β”œβ”€β”€ build_msix.bat        # Microsoft Store package builder
β”‚   β”œβ”€β”€ change_version.bat    # Interactive version management script
β”‚   β”œβ”€β”€ generate-icons.ps1    # PowerShell script to generate AppX store logo variants
β”‚   └── set-version.js        # Automated semantic version updater
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/                 # Electron Main Process
β”‚   β”‚   β”œβ”€β”€ detector/         # Plagiarism & AI detection engine (NLP, entropy, shingling)
β”‚   β”‚   β”‚   β”œβ”€β”€ detectorEngine.ts
β”‚   β”‚   β”‚   └── detectorEngine.test.ts
β”‚   β”‚   β”œβ”€β”€ grammar/          # Rule-based quick grammar, style & linguistic engines
β”‚   β”‚   β”‚   β”œβ”€β”€ rules/        # Narration, voice, degree, dictionary, typography rules
β”‚   β”‚   β”‚   β”œβ”€β”€ AIGrammarEngine.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ QuickGrammarEngine.ts
β”‚   β”‚   β”‚   └── QuickGrammarEngine.test.ts
β”‚   β”‚   β”œβ”€β”€ models/           # ONNX model manager & direct HTTPS download coordinator
β”‚   β”‚   β”‚   └── ModelManager.ts
β”‚   β”‚   β”œβ”€β”€ aiWorker.ts       # Isolated background worker thread for AI inference
β”‚   β”‚   β”œβ”€β”€ index.ts          # Main process entry, IPC handlers, WMI GPU query, window lifecycle
β”‚   β”‚   β”œβ”€β”€ preload.ts        # Secure contextBridge IPC bridge
β”‚   β”‚   └── storage.ts        # Persistent JSON storage for user settings & custom dictionaries
β”‚   └── renderer/             # React 19 Frontend (Vite)
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/   # Reusable UI components (Sidebar, TitleBar, ConfirmModal, ReportModal)
β”‚       β”‚   β”œβ”€β”€ pages/        # Studio pages (Dashboard, Editor, Prompt, Translation, Detector, Analysis, Settings, About)
β”‚       β”‚   β”œβ”€β”€ styles/       # Design system, glassmorphism tokens & custom CSS themes
β”‚       β”‚   β”œβ”€β”€ App.tsx       # Root layout & studio view routing
β”‚       β”‚   └── main.tsx      # React DOM entry point
β”‚       └── index.html        # HTML shell
β”œβ”€β”€ .gitignore                # Git ignore patterns
β”œβ”€β”€ CHANGELOG.md              # Detailed release history & migration notes
β”œβ”€β”€ CONTRIBUTING.md           # Contribution guidelines & development conventions
β”œβ”€β”€ LICENSE                   # GPL-3.0 Open Source License
β”œβ”€β”€ package.json              # Project configuration & build target definitions
β”œβ”€β”€ tsconfig.json             # Renderer TypeScript configuration
β”œβ”€β”€ tsconfig.node.json        # Main process TypeScript configuration
β”œβ”€β”€ vite.config.ts            # Vite bundler configuration
└── vitest.config.ts          # Unit test configuration

πŸ›  Tech Stack

Domain Technology Description
Desktop Shell Electron 43 Cross-platform Chromium & Node.js desktop framework
Frontend Framework React 19 Component architecture & modern state management
Language TypeScript 7 Strict type safety across main and renderer processes
Bundler & Tooling Vite 8 Lightning-fast HMR and optimized production bundling
Local AI Engine @xenova/transformers Local ONNX pipeline execution for Seq2Seq, LLMs, and classifiers
GPU Acceleration Microsoft DirectML (NAPI v6) Cross-vendor GPU acceleration for AMD, NVIDIA, and Intel hardware
Translation Engine Meta NLLB-200 Distilled 100% offline multilingual translation across 200+ languages
AI Detection & Audit ModernBERT RAID + NLP Metrics Quantized neural classifiers & entropy/perplexity statistical metrics
Natural Language Heuristics Compromise, NSpell, Write-Good Sub-millisecond spelling, style, and syntactic parsing
Icons Lucide React Clean, consistent vector iconography
Test Runner Vitest 4 Fast unit testing for grammar and detector engines
Packager electron-builder 26 NSIS standalone installer and signed AppX / MSIX packaging

πŸ§ͺ Testing

Run comprehensive unit tests covering the grammar rule engine and AI/plagiarism detector via Vitest:

npm test

🀝 Contributing

Contributions, bug reports, and feature suggestions are welcome! Please check out CONTRIBUTING.md for local development workflows and guidelines.


πŸ“„ License

This project is licensed under the GNU General Public License v3.0.

About

Private intelligent writing assistant powered by local on-device AI

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages