This project is a full-stack web application developed to analyze user submitted text. It provides detailed insights such as word count, character count, readability score, and a frequency analysis of the most common words. The goal of the project was to practice building a RESTful API using ASP.NET Core, and making it a responsive JavaScript-based frontend interface.
- HTML5 β For structural layout
- CSS3 β Custom styles and bar charts
- Vanilla JavaScript (ES6+) β Handles input validation, API requests, and dynamic rendering
- Bootstrap β Responsive layout and styled components
- ASP.NET Core Web API β Serves the
/api/textanalysisendpoint - C# β Business logic for text analysis
- Regex (System.Text.RegularExpressions) β Tokenization and sentence detection
- Swagger β Built-in API documentation and testing interface
- CORS configuration β Enables frontend-backend communication during development
- π Submit raw text via a single-page frontend interface
- π’ Statistics returned:
- Word count
- Character count (excluding whitespace)
- Flesch Reading Ease index
- Top 5 most frequent words
- π Visual representation of word frequency
- π Readability classification based on index:
- Green = Easy
- Orange = Medium
- Red = Hard
- π± Responsive layout across all devices
-
Service Layer (
TextAnalysisService.cs): Core analysis is handled here-
Words are extracted using
Regex -
Syllables are estimated using a simplified vowel-counting heuristic
-
Sentences are split on punctuation (
.,!,?) -
Flesch Reading Ease formula:
206.835 - 1.015 * (words / sentences) - 84.6 * (syllables / words)
-
-
Controller Layer (
TextAnalysisController.cs):- Exposes a single
POSTroute - Accepts a JSON body containing the
inputText - Returns a
TextAnalysisResultobject with computed data
- Exposes a single
TextAnalysisApp/
βββ FRONTEND/ # Static frontend files
β βββ index.html # Single-page UI
β βββ css
β β βββ style.css # Custom styling + chart visuals
β β js
β β βββ script.js # Fetch call to backend, DOM rendering
βββ BACKEND/ # ASP.NET Core Web API
β βββ Controllers/
β β βββ TextAnalysisController.cs # POST endpoint handler
β βββ Services/
β β βββ ITextAnalysisService.cs # Interface
β β βββ TextAnalysisService.cs # Implementation of core logic
β βββ Models/
β β βββ TextAnalysisRequest.cs # Input model
β β βββ TextAnalysisResult.cs # Output model
β β βββ WordFrequency.cs # Word-frequency pair
β βββ Program.cs # Startup config, routing, CORS, Swagger