Skip to content

filemat/text-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Text Analysis Web Application

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.

πŸ› οΈ Technologies Used

Frontend

  • 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

Backend

  • ASP.NET Core Web API – Serves the /api/textanalysis endpoint
  • 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

πŸ“Š Key Features

  • πŸ“ 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

🧠 Backend Logic Overview

  • 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 POST route
    • Accepts a JSON body containing the inputText
    • Returns a TextAnalysisResult object with computed data

πŸ“ Project Structure

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

About

Text analysing application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published