# calebscott0/text-indexer architecture

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

- Interactive diagram: https://gitdiagram.com/calebscott0/text-indexer
- Repository: https://github.com/calebscott0/text-indexer

## Overview

text-indexer is a command-line tool that builds a word-to-file-and-line index from named text files, then lets a user search that index interactively. The main workflow selects either an AVL-tree or hash-table backend, tokenizes input, filters stop words, records locations, and prints matches. The README is only a title; the sampled source shows the core flow and both backends, but does not establish additional product capabilities.

Main entry points: [`src/main.c`](https://github.com/calebscott0/text-indexer/blob/main/src/main.c) (CLI Workflow), [`src/index.c`](https://github.com/calebscott0/text-indexer/blob/main/src/index.c) (Index Facade), [`src/avl.c`](https://github.com/calebscott0/text-indexer/blob/main/src/avl.c) (AVL Backend), [`src/hash.c`](https://github.com/calebscott0/text-indexer/blob/main/src/hash.c) (Hash Backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Indexing and Search"]
  node_cli["CLI Workflow<br/>[main.c]"]
  node_tokenizer["Tokenization<br/>[token.c]"]
  node_stop_filter["Stop-word Filter<br/>[main.c]"]
  node_index_facade["Index Facade<br/>[index.c]"]
end

subgraph group_backends["Index Backends"]
  node_avl["AVL Backend<br/>[avl.c]"]
  node_hash["Hash Backend<br/>[hash.c]"]
end

subgraph group_postings["Location Storage"]
  node_locations["Location Records<br/>[utils.c]"]
end

node_user(("User"))
node_files["Input Files"]

node_user -->|"selects and searches"| node_cli
node_files -->|"provides text"| node_cli
node_cli -->|"reads tokens"| node_tokenizer
node_cli -->|"checks tokens"| node_stop_filter
node_cli -->|"inserts, searches, clears"| node_index_facade
node_index_facade -->|"dispatches tree operations"| node_avl
node_index_facade -->|"dispatches hash operations"| node_hash
node_avl -->|"creates and updates records"| node_locations
node_hash -->|"creates and updates records"| node_locations
node_index_facade -->|"prints matches"| node_user

click node_cli "https://github.com/calebscott0/text-indexer/blob/main/src/main.c"
click node_tokenizer "https://github.com/calebscott0/text-indexer/blob/main/src/token.c"
click node_stop_filter "https://github.com/calebscott0/text-indexer/blob/main/src/main.c"
click node_index_facade "https://github.com/calebscott0/text-indexer/blob/main/src/index.c"
click node_avl "https://github.com/calebscott0/text-indexer/blob/main/src/avl.c"
click node_hash "https://github.com/calebscott0/text-indexer/blob/main/src/hash.c"
click node_locations "https://github.com/calebscott0/text-indexer/blob/main/src/utils.c"

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_cli,node_tokenizer,node_stop_filter,node_index_facade,node_user toneBlue
class node_avl,node_hash toneAmber
class node_locations toneMint
class node_files toneIndigo
```

## Components

### Indexing and Search

- [CLI Workflow](https://github.com/calebscott0/text-indexer/blob/main/src/main.c): `src/main.c`
- [Tokenization](https://github.com/calebscott0/text-indexer/blob/main/src/token.c): `src/token.c`
- [Stop-word Filter](https://github.com/calebscott0/text-indexer/blob/main/src/main.c): `src/main.c`
- [Index Facade](https://github.com/calebscott0/text-indexer/blob/main/src/index.c): `src/index.c`

### Index Backends

- [AVL Backend](https://github.com/calebscott0/text-indexer/blob/main/src/avl.c): `src/avl.c`
- [Hash Backend](https://github.com/calebscott0/text-indexer/blob/main/src/hash.c): `src/hash.c`

### Location Storage

- [Location Records](https://github.com/calebscott0/text-indexer/blob/main/src/utils.c): `src/utils.c`

### Other components

- **User**
- **Input Files**

## Connections

- User → CLI Workflow: selects and searches (evidence: `src/main.c`)
- Input Files → CLI Workflow: provides text (evidence: `src/main.c`)
- CLI Workflow → Tokenization: reads tokens (evidence: `src/main.c`)
- CLI Workflow → Stop-word Filter: checks tokens (evidence: `src/main.c`)
- CLI Workflow → Index Facade: inserts, searches, clears (evidence: `src/main.c`)
- Index Facade → AVL Backend: dispatches tree operations (evidence: `src/index.c`)
- Index Facade → Hash Backend: dispatches hash operations (evidence: `src/index.c`)
- AVL Backend → Location Records: creates and updates records (evidence: `src/avl.c`)
- Hash Backend → Location Records: creates and updates records (evidence: `src/hash.c`)
- Index Facade → User: prints matches (evidence: `src/index.c`)
