How zayuvalya/ai-text-humanizer works
Project Type and Purpose
• This is a frontend‐only, single‐page web application that runs entirely in the browser without any server component.
• Its purpose is to take user-supplied text, run a context-aware paraphrasing algorithm on it, and render a “humanized” version with highlighted changes, while also showing word/sentence counts.
High‐Level Architecture Overview
Break the system into three logical layers:
a. Presentation Layer (UI)
• index.html: Defines the input area, buttons, and output container.
• styles.css: Implements dark theme and responsive layout.
b. Application Logic Layer (Paraphrasing Engine)
• script.js: Contains modules for tokenization, classification, replacement, highlighting, and counters.
c. Data Layer (Resources)
• eng_synonyms.json: Vocabulary of words → synonyms.
• stop_words.json: List of unchangeable common words.
• fixedterms.json (or inline array): Fixed terms that must remain intact.
Main Components and Their Interactions
1. User Interface Component
• "Paraphrase" Button
• Output Display Area with highlighted spans
• Word/Sentence Counter Display
2. Tokenizer Module
• Splits text into tokens: words, whitespace, punctuation.
3. Classifier Module
• isStopWord(token)
• isFixedTerm(token)
• isProperNoun(token)
4. Replacement Module
• replaceWord(token) looks up synonyms in eng_synonyms.json
5. Highlighting Module
• Wraps replaced words in …
6. Counter Module
• countWords(text)
• countSentences(text)
7. Data Resources
• JSON loaders for vocabulary and stop words at initialization
Data flow:
User Input → Tokenizer → Classifier → Replacement → Highlighter → Render Output → Counter updates
Architectural Patterns and Principles
• Separation of Concerns: UI vs. logic vs. data
• Data-driven design: JSON files drive algorithm behavior
• Modular JavaScript: encapsulate classification, replacement, and counting into distinct functions