# osmantalayhan/text-file-analyzer architecture

> Architecture diagram of the GitHub repository osmantalayhan/text-file-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/osmantalayhan/text-file-analyzer
- Repository: https://github.com/osmantalayhan/text-file-analyzer

## Overview

##### Project type and purpose
- This is a small, single-purpose, open-source, command-line Text File Analyzer written in Python.
- It reads a text file, parses sentences, computes statistics (word counts, longest/shortest words, per-sentence word lists/counts, max-word sentence) and performs sentiment analysis via TextBlob.

##### File structure
- Top-level files only:
- main.py – the entry-point and CLI orchestrator
- analyzer.py – core text-processing and analysis logic
- overview.txt – sample input data (text file)
- No web frontend or database – purely file I/O, computation, and console output.

##### README for additional insights
- Confirms the use of Python 3, and that TextBlob is the only external library.
- Describes all analysis features, so you know which internal components to decompose.

a. Main components
- CLI Runner (main.py)
- Analyzer Module (analyzer.py)
– Text Parser
– Statistics Calculator
– Sentiment Analyzer (invokes TextBlob)
- Input Text File (overview.txt or user-provided file)
- Console Output / Reporter
- External Library (TextBlob)

b. Relationships and interactions
1. CLI Runner reads the Input File.
2. CLI Runner invokes Analyzer Module, passing raw text.
3. Analyzer Module performs parsing & statistical computations, then calls the Sentiment Analyzer subcomponent.
4. Sentiment Analyzer delegates to TextBlob API.
5. Analyzer Module returns a structured result object to CLI Runner.
6. CLI Runner formats and prints results to the console.

c. Architectural patterns / design principles
- Simple modularization: separation of concerns between I/O/orchestration (main.py) and pure analysis logic (analyzer.py).
- Single responsibility: each function/class in analyzer.py handles one type of analysis.

d. Key technologies / libraries
- Python 3 runtime
- TextBlob (for sentiment polarity & subjectivity)

##### Essential architectural elements to capture
- Module boundaries (main.py vs analyzer.py)
- Data flow sequence (file → analysis → output)
- External dependency interaction (TextBlob)
- Internal sub-components within analyzer.py (parsing, stats, sentiment)

## Diagram (Mermaid)

```mermaid
flowchart TD
    overview["overview.txt"]:::data
    main["CLI Runner\n(main.py)"]:::internal
    console["Console Output"]:::output

    subgraph "Analyzer Module"
        parser["Text Parser"]:::internal
        stats["Statistics Calculator"]:::internal
        sentiment["Sentiment Analyzer"]:::internal
    end

    textblob["TextBlob"]:::external

    overview -->|reads file| main
    main -->|invokes parsing| parser
    parser -->|passes sentences| stats
    stats -->|computes stats| sentiment
    sentiment -->|calls API| textblob
    textblob -->|returns sentiment| sentiment
    sentiment -->|returns results| main
    main -->|formats & prints| console

    click overview "https://github.com/osmantalayhan/text-file-analyzer/blob/main/overview.txt"
    click main "https://github.com/osmantalayhan/text-file-analyzer/blob/main/main.py"
    click parser "https://github.com/osmantalayhan/text-file-analyzer/blob/main/analyzer.py"
    click stats "https://github.com/osmantalayhan/text-file-analyzer/blob/main/analyzer.py"
    click sentiment "https://github.com/osmantalayhan/text-file-analyzer/blob/main/analyzer.py"
    click console "https://github.com/osmantalayhan/text-file-analyzer/blob/main/main.py"

    classDef internal fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef data fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef output fill:#D3D3D3,stroke:#000,stroke-width:1px
```
