Skip to content

youssef-othman22/Text-Data-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Text Data Analyzer 📊

A command-line C# application that analyzes text and CSV files in a directory, providing detailed statistics about file content.

Features

Text File Analysis (.txt)

  • Word count
  • Character count
  • Line count

CSV File Analysis (.csv)

  • Field/column count

Additional Capabilities

  • Batch Processing: Analyzes all supported files in a specified directory
  • Extensible Architecture: Easy to add support for new file types

Architecture

The project follows Object-Oriented Programming principles:

  • Interface-based design (IFileAnalysis)
  • Inheritance with abstract FileAnalyzer base class
  • Extension methods for clean file type checking
  • Separation of concerns with dedicated analyzer classes for each file type

Project Structure

FileAnalyzerProject/
├── Main.cs                    # Entry point
├── FileAnalyzer.cs            # Base analyzer class
├── TxtFileAnalyzer.cs         # Text file analyzer implementation
├── CsvFileAnalyzer.cs         # CSV file analyzer implementation
├── IFileAnalysis.cs           # Analysis interface
├── AnalysisResults.cs         # Results data structure
└── FileInfoExtension.cs       # File type extension methods

Getting Started

Prerequisites

  • .NET 6.0 or higher
  • C# compiler

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/Text-Data-Analyzer.git
cd Text-Data-Analyzer
  1. Build the project:
dotnet build
  1. Run the application:
dotnet run

Usage

  1. Run the application
  2. Enter the full path to the folder you want to analyze
  3. The application will process all .txt and .csv files and display results

Example Output

Welcome To Text File Analyzer :)
Please Enter The Entire Folder Path To Analyze
C:\MyDocuments

------------------------
File Name : sample.txt
------------------------
Number Of Words : 150
Number Of Lines : 25
Number Of Characters : 850

------------------------
File Name : data.csv
------------------------
Number Of Fields : 5

Technical Details

Design Patterns Used

  • Strategy Pattern: Different analyzers implement the same interface
  • Extension Methods: Clean syntax for file type checking

Key Classes

Class Description
IFileAnalysis Interface defining the contract for file analyzers
FileAnalyzer Base class containing common functionality
AnalysisResults Struct holding analysis results
TxtFileAnalyzer Implements text file analysis
CsvFileAnalyzer Implements CSV file analysis

Future Enhancements

  • Support for additional file formats (JSON, XML, etc.)
  • More detailed CSV analysis (row count, data types)
  • Export results to file
  • GUI interface
  • Unit tests
  • Performance optimization for large files

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Feel free to ⭐ this repository if you found it helpful!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages