ClarityWorks — AI-Powered Text Readability Analysis and Simplification System

Computer Science

Description

ClarityWorks is a Final Year Project for a Bachelor's in Computer Science. It is a full-stack text readability analysis platform built with React, Node.js/Express, PostgreSQL, and a Python/Flask ML microservice. Users can input text via paste, PDF upload, DOCX upload, image OCR, or voice. The system analyzes the text using 8 traditional readability formulas and a 3-model machine learning ensemble (Random Forest, Gradient Boosting, XGBoost) trained on the CLEAR Corpus (~4,724 samples, grades 3–12). It predicts grade level with 80.2% accuracy within ±1 grade (R² = 0.926). Additional features include text simplification using a hybrid NLP pipeline, RAG-based textbook querying, vocabulary analysis, complexity scoring, and detailed PDF report generation.

Objectives

The primary objective of ClarityWorks is to make text readability assessment and improvement accessible to students, educators, and content creators through an intelligent web-based platform. Specific objectives include: 1. Accurate Grade-Level Prediction: Train a 3-model ensemble (Random Forest, Gradient Boosting, XGBoost) on the CLEAR Corpus (~4,724 samples) to predict text reading grade levels with high accuracy (achieved MAE of 0.712 grade levels, R² = 0.926, 80.2% within ±1 grade). 2. Multi-Method Text Input: Allow users to input text through five methods — direct paste/typing, PDF upload, DOCX upload, image OCR (using Tesseract locally), and voice (Web Speech API). 3. Comprehensive Readability Analysis: Compute 8 traditional readability scores (Flesch Reading Ease, Flesch-Kincaid Grade, ARI, SMOG, Coleman-Liau, Dale-Chall, Linsear Write, Gunning Fog) alongside 16 ML features including 5 spaCy NLP features. 4. Text Simplification: Implement a hybrid text simplification engine supporting both automatic and interactive modes, using curated word maps, WordNet synonym lookup with Lesk word sense disambiguation, Datamuse API fallback, and Groq AI validation. 5. Retrieval-Augmented Generation (RAG): Enable users to upload textbooks (PDF/DOCX) and query them semantically using E5-small-v2 embeddings, FlashRank cross-encoder re-ranking, and Groq LLM for AI-generated answers with source citations. 6. Visualization and Reporting: Present results through interactive charts (radar, bar, pie, gauge), a vocabulary level breakdown (Simple/Medium/Advanced/Expert), difficulty heatmaps, improvement suggestions, and multi-page PDF report export. 7. User Management: Provide a secure full-stack application with JWT authentication, password hashing (bcrypt), role-based access (user/admin), and admin panel for platform management.

Socio-economic benefit

ClarityWorks addresses a real and widespread challenge: the mismatch between the reading level of available content and the comprehension ability of its intended audience. This has broad socio-economic implications. 1. Educational Accessibility: Students from underprivileged backgrounds often struggle with dense academic texts. ClarityWorks helps identify whether a text is appropriate for a student's grade level and simplifies it when it is not, making education more accessible. 2. Teacher and Curriculum Support: Educators can use the platform to evaluate textbooks, study materials, and exam questions for grade-appropriateness, saving time and improving teaching quality. 3. Content Creation for Public Communication: Government documents, health advisories, and legal notices are often written at a college reading level. ClarityWorks can help writers simplify public communications, making them accessible to a wider audience. 4. Support for Learners with Dyslexia or Learning Disabilities: By simplifying vocabulary and sentence structure, the platform can assist students with reading difficulties. 5. Research and Academic Value: The platform demonstrates practical application of NLP, machine learning, and RAG technologies in an educational context — contributing to the knowledge base of Pakistani CS graduates and their technical readiness. 6. Local Talent Development: As a fully self-hosted, locally run system (no paid cloud APIs required for core features), it demonstrates that capable AI systems can be built and deployed within local academic institutions. 7. Productivity Enhancement: Professionals who need to write for specific audiences (e.g., journalists, public health communicators) can use the tool to assess and improve their content's readability without manual expertise.

Methodologies

ClarityWorks follows a three-tier microservice architecture and employs the following methodologies: 1. Machine Learning Pipeline: - Dataset: CLEAR Corpus (~4,724 samples, grades 3–12), using Flesch-Kincaid Grade Level as the regression target. - Feature Engineering: 16 features per text — 11 classical metrics (word count, sentence count, avg syllables, Flesch scores, ARI, SMOG, Coleman-Liau, type-token ratio, difficult word percentage) plus 5 spaCy NLP features (passive voice %, subordinate clause density, POS diversity, lexical diversity, sentence complexity variance). - Models: Random Forest, Gradient Boosting, XGBoost — tuned via GridSearchCV (5-fold cross-validation). - Ensemble: Average of 3 model predictions; confidence derived from standard deviation across models. 2. Text Simplification: - Hybrid pipeline: curated simplification map ? WordNet + Lesk WSD ? Datamuse API ? Groq AI validation. - Sentence splitting via spaCy dependency parsing (advcl, relcl, coordinating conjunctions). - Interactive mode allows users to accept/deny individual changes with real-time preview. 3. Retrieval-Augmented Generation (RAG): - Documents chunked via RecursiveCharacterTextSplitter (1500 chars, 300 overlap). - Embedded with E5-small-v2 (384-dim); stored in ChromaDB. - 2-stage retrieval: top-20 via embedding similarity ? FlashRank cross-encoder re-ranks to top-5. - Groq LLM (llama-3.3-70b-versatile) synthesizes answers from retrieved chunks with [Source N] citations. 4. System Architecture: - Frontend: React 18 + TypeScript + Vite + TailwindCSS. - Backend: Node.js + Express.js + PostgreSQL (5 tables: users, analyses, simplification_history, rag_documents, rag_queries). - ML Service: Python 3.9+ + Flask (12+ endpoints). - JWT-based auth, bcrypt password hashing, role-based access control. 5. Testing and Validation: - 11 calibrated test files (Grade 3–12 + College), all passing with graduated tolerance (±1.0 for grades 3–8, ±1.5 for 9–12, ±2.0 for college). - Selenium-based end-to-end tests. - Groq AI validates simplification changes for semantic correctness.

Outcome

ClarityWorks successfully delivers a production-ready full-stack AI web application with the following measurable outcomes: 1. ML Model Performance: - MAE: 0.712 grade levels (improved from ~0.85 baseline) - R² Score: 0.926 - Within ±1 grade accuracy: 80.2% - Within ±0.5 grade accuracy: 57.6% 2. Feature Completeness: All planned features are fully implemented — multi-method text input (5 methods), readability analysis, grade prediction, difficulty detection, data visualization (6 chart types), text simplification (auto + interactive), RAG textbook querying, history tracking, batch analysis, comparative analysis, dark mode, and a multi-page PDF report generator. 3. Text Simplification: Bidirectional rewrite engine (simplify or complexify text) tested on Grade 3 narratives targeting Grade 6, 8, and 10 levels — all produced correct or near-correct ML grade predictions. 4. RAG System: True RAG pipeline with AI-generated answers, expandable sources, and PDF/DOCX export. FlashRank re-ranking improves precision of retrieved chunks significantly over raw embedding similarity. 5. System Reliability: Robust error handling including FlashRank fail-safe fallback, OCR cleaning utility, and automatic ChromaDB model migration on embedding model upgrade. 6. User Interface: Fully responsive React SPA with dark mode, loading spinners, grade-level explanations (layman/technical toggle), text heatmaps, vocabulary level charts, and interactive simplification. 7. Admin Panel: Complete user and analysis management system with platform-wide statistics. GitHub Repository: https://github.com/junaaper/ClarityWorksV2

Gallery

More from Computer Science

Ustad Go: An AI-Powered Mobile and Web Ecosystem for Verified Local Service Provision in P…

Computer Science

Ustad Go is a dual-platform solution bridging the gap between skilled local service providers and households.…

Supervisor: Dr. Wasif Nisar

Sales Distribution Hub

Computer Science

The Sales Distribution Hub is a web-based management system designed for Masood & Company to automate and stre…

Supervisor: Dr. Wasif Nisar.

AI Based Road Damage Detection System

Computer Science

AI Based Road Damage Detection System is a smart application that uses YOLOv8 and computer vision techniques t…

Supervisor: Mehwish Mukhtar

EvaluTech: AI-Powered Hiring & Job Platform for Employers and Applicants

Computer Science

EvaluTech is an intelligent recruitment management platform that streamlines the complete hiring lifecycle fro…

Supervisor: Dr. Wasif Nisar