# manuelparra1/book-summary architecture

> Architecture diagram of the GitHub repository manuelparra1/book-summary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manuelparra1/book-summary
- Repository: https://github.com/manuelparra1/book-summary

## Overview

This is a small book-summarization toolchain: text cleanup is a standalone script, while tokenization writes JSON chunks that the summarizer sends to OpenAI and prints as summaries. The excerpts show those file operations and API call. The README describes automatic summarization and configurable settings, but the sampled summarizer uses hard-coded parameters. The tokenizer’s filename filter does not match the chapter filenames listed in the tree, so a connection from those chapters to tokenization is not asserted.

Main entry points: [`summarizer.py`](https://github.com/manuelparra1/book-summary/blob/main/summarizer.py) (API summarizer), [`tokenizer.py`](https://github.com/manuelparra1/book-summary/blob/main/tokenizer.py) (Text tokenizer), [`token_chunks.json`](https://github.com/manuelparra1/book-summary/blob/main/token_chunks.json) (Token chunks), [`cleaner.py`](https://github.com/manuelparra1/book-summary/blob/main/cleaner.py) (Text cleaner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Text preparation"]
  node_chapters["Chapter text<br/>[chapter_1.txt]"]
  node_cleaner["Text cleaner<br/>[cleaner.py]"]
end

subgraph group_chunks["Chunk generation"]
  node_tokenizer["Text tokenizer<br/>[tokenizer.py]"]
  node_chunkdata["Token chunks<br/>[token_chunks.json]"]
end

subgraph group_generation["Summary generation"]
  node_summarizer["API summarizer<br/>[summarizer.py]"]
  node_summaries["Printed summaries"]
end

node_spacy["spaCy model"]
node_openai["OpenAI API"]

node_cleaner -->|"reads and rewrites"| node_chapters
node_tokenizer -->|"loads model"| node_spacy
node_tokenizer -->|"writes chunks"| node_chunkdata
node_summarizer -->|"reads chunks"| node_chunkdata
node_summarizer -->|"requests summaries"| node_openai
node_summarizer -->|"prints results"| node_summaries

click node_chapters "https://github.com/manuelparra1/book-summary/blob/main/chapter_1.txt"
click node_cleaner "https://github.com/manuelparra1/book-summary/blob/main/cleaner.py"
click node_tokenizer "https://github.com/manuelparra1/book-summary/blob/main/tokenizer.py"
click node_chunkdata "https://github.com/manuelparra1/book-summary/blob/main/token_chunks.json"
click node_summarizer "https://github.com/manuelparra1/book-summary/blob/main/summarizer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chapters,node_cleaner toneBlue
class node_tokenizer,node_chunkdata toneAmber
class node_summarizer,node_summaries,node_openai toneMint
class node_spacy toneIndigo
```

## Components

### Text preparation

- [Chapter text](https://github.com/manuelparra1/book-summary/blob/main/chapter_1.txt): `chapter_1.txt`
- [Text cleaner](https://github.com/manuelparra1/book-summary/blob/main/cleaner.py): `cleaner.py`

### Chunk generation

- [Text tokenizer](https://github.com/manuelparra1/book-summary/blob/main/tokenizer.py): `tokenizer.py`
- [Token chunks](https://github.com/manuelparra1/book-summary/blob/main/token_chunks.json): `token_chunks.json`

### Summary generation

- [API summarizer](https://github.com/manuelparra1/book-summary/blob/main/summarizer.py): `summarizer.py`
- **Printed summaries**

### Other components

- **spaCy model**
- **OpenAI API**

## Connections

- Text cleaner → Chapter text: reads and rewrites (evidence: `cleaner.py`)
- Text tokenizer → spaCy model: loads model (evidence: `tokenizer.py`)
- Text tokenizer → Token chunks: writes chunks (evidence: `tokenizer.py`)
- API summarizer → Token chunks: reads chunks (evidence: `summarizer.py`)
- API summarizer → OpenAI API: requests summaries (evidence: `summarizer.py`)
- API summarizer → Printed summaries: prints results (evidence: `summarizer.py`)
