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
Clone the repository:
git clone https://github.com/yourus...
cd Text-Data-Analyzer
Build the project:
dotnet build
Run the application:
dotnet run
Usage
Run the application
Enter the full path to the folder you want to analyze
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.