# wordbench/wordwinnow architecture

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

- Interactive diagram: https://gitdiagram.com/wordbench/wordwinnow
- Repository: https://github.com/wordbench/wordwinnow

## Overview

Wordwinnow analyzes learner-selected text and returns vocabulary ranked for study. The principal workflow starts in the CLI or distributed intake service, acquires custom or New York Times text, processes linguistic structure, lexical senses, CEFR levels and dictionary meanings, then winnows results against the learner’s level, target and known words. Results are persisted and presented as reports; distributed mode additionally uses Kafka workers and records completed-analysis facts for aggregation. Several subsystem links reflect README-documented behavior; unsampled adapter wiring is not inferred.

Main entry points: [`wordwinnow/application/use_cases/process_an_analysis.py`](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/process_an_analysis.py) (Process analysis), [`wordwinnow/services/intake/app.py`](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/intake/app.py) (Intake API), [`wordwinnow/services/cli/main.py`](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/cli/main.py) (CLI), [`wordwinnow/application/use_cases/acquire_a_document.py`](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/acquire_a_document.py) (Document acquisition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and intake"]
  node_cli["CLI<br/>[main.py]"]
  node_intake["Intake API<br/>[app.py]"]
  node_acquire["Document acquisition"]
  node_report["Reports<br/>[report.py]"]
end

subgraph group_analysis["Analysis pipeline"]
  node_request["Request analysis"]
  node_process["Process analysis"]
end

subgraph group_domain["Domain model"]
  node_levels["Level assessment<br/>[cefr.py]"]
  node_winnow["Study winnowing<br/>[study.py]"]
  node_analysismodel["Analysis lifecycle<br/>[analysis.py]"]
end

subgraph group_adapters["Infrastructure adapters"]
  node_custom["Custom text<br/>[custom_text.py]"]
  node_nyt["NYT sources"]
  node_broker["Message bus"]
  node_linguistics["Linguistic analysis<br/>[nltk_analyzer.py]"]
  node_lexical["Lexical semantics"]
  node_levelmodel["Level model<br/>[model.py]"]
  node_dictionary["Dictionary enrichment<br/>[free_dictionary.py]"]
  node_repository[("Analysis repository")]
  node_analytics[("Analytics store<br/>[clickhouse.py]")]
end

subgraph group_ops["Results and operations"]
  node_worker["Analysis worker<br/>[workers.py]"]
  node_facts["Vocabulary facts<br/>[dto.py]"]
  node_factworker["Facts worker<br/>[workers.py]"]
end

node_learner(("Learner"))

node_learner -->|"provides text and profile"| node_cli
node_cli -->|"submits analysis"| node_intake
node_intake -->|"acquires document"| node_acquire
node_acquire -.->|"reads custom text"| node_custom
node_acquire -.->|"fetches articles"| node_nyt
node_intake -->|"requests analysis"| node_request
node_request -.->|"stores request"| node_repository
node_request -.->|"publishes request"| node_broker
node_broker -.->|"delivers message"| node_worker
node_worker -->|"runs pipeline"| node_process
node_process -.->|"analyzes text"| node_linguistics
node_process -.->|"retrieves senses"| node_lexical
node_process -.->|"assesses levels"| node_levels
node_process -.->|"predicts levels"| node_levelmodel
node_process -.->|"looks up meanings"| node_dictionary
node_process -->|"places vocabulary"| node_winnow
node_process -->|"completes lifecycle"| node_analysismodel
node_process -.->|"persists result"| node_repository
node_intake -.->|"reads analysis"| node_repository
node_cli -.->|"renders result"| node_report
node_analysismodel -->|"derives facts"| node_facts
node_worker -->|"records completed facts"| node_factworker
node_factworker -->|"builds facts"| node_facts
node_factworker -.->|"records facts"| node_analytics

click node_cli "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/cli/main.py"
click node_intake "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/intake/app.py"
click node_acquire "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/acquire_a_document.py"
click node_custom "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/sources/custom_text.py"
click node_nyt "https://github.com/wordbench/wordwinnow/tree/main/wordwinnow/infrastructure/sources/nyt"
click node_request "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/request_an_analysis.py"
click node_broker "https://github.com/wordbench/wordwinnow/tree/main/wordwinnow/infrastructure/messaging"
click node_worker "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/workers.py"
click node_process "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/process_an_analysis.py"
click node_linguistics "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/linguistics/nltk_analyzer.py"
click node_lexical "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/lexicon/wordnet_semantics.py"
click node_levels "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/cefr.py"
click node_levelmodel "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/ml/model.py"
click node_dictionary "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/dictionary/free_dictionary.py"
click node_winnow "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/study.py"
click node_analysismodel "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/analysis.py"
click node_repository "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/persistence/analysis_repository.py"
click node_report "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/cli/report.py"
click node_facts "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/dto.py"
click node_factworker "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/workers.py"
click node_analytics "https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/analytics/clickhouse.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_cli,node_intake,node_acquire,node_report toneBlue
class node_request,node_process toneAmber
class node_levels,node_winnow,node_analysismodel toneMint
class node_custom,node_nyt,node_broker,node_linguistics,node_lexical,node_levelmodel,node_dictionary,node_repository,node_analytics toneRose
class node_worker,node_facts,node_factworker,node_learner toneIndigo
```

## Components

### Entry and intake

- [CLI](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/cli/main.py): `wordwinnow/services/cli/main.py`
- [Intake API](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/intake/app.py): `wordwinnow/services/intake/app.py`
- [Document acquisition](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/acquire_a_document.py): `wordwinnow/application/use_cases/acquire_a_document.py`
- [Reports](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/cli/report.py): `wordwinnow/services/cli/report.py`

### Analysis pipeline

- [Request analysis](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/request_an_analysis.py): `wordwinnow/application/use_cases/request_an_analysis.py`
- [Process analysis](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/use_cases/process_an_analysis.py): `wordwinnow/application/use_cases/process_an_analysis.py`

### Domain model

- [Level assessment](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/cefr.py): `wordwinnow/domain/cefr.py`
- [Study winnowing](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/study.py): `wordwinnow/domain/study.py`
- [Analysis lifecycle](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/domain/analysis.py): `wordwinnow/domain/analysis.py`

### Infrastructure adapters

- [Custom text](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/sources/custom_text.py): `wordwinnow/infrastructure/sources/custom_text.py`
- [NYT sources](https://github.com/wordbench/wordwinnow/tree/main/wordwinnow/infrastructure/sources/nyt): `wordwinnow/infrastructure/sources/nyt`
- [Message bus](https://github.com/wordbench/wordwinnow/tree/main/wordwinnow/infrastructure/messaging): `wordwinnow/infrastructure/messaging`
- [Linguistic analysis](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/linguistics/nltk_analyzer.py): `wordwinnow/infrastructure/linguistics/nltk_analyzer.py`
- [Lexical semantics](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/lexicon/wordnet_semantics.py): `wordwinnow/infrastructure/lexicon/wordnet_semantics.py`
- [Level model](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/ml/model.py): `wordwinnow/infrastructure/ml/model.py`
- [Dictionary enrichment](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/dictionary/free_dictionary.py): `wordwinnow/infrastructure/dictionary/free_dictionary.py`
- [Analysis repository](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/persistence/analysis_repository.py): `wordwinnow/infrastructure/persistence/analysis_repository.py`
- [Analytics store](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/infrastructure/analytics/clickhouse.py): `wordwinnow/infrastructure/analytics/clickhouse.py`

### Results and operations

- [Analysis worker](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/workers.py): `wordwinnow/services/workers.py`
- [Vocabulary facts](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/application/dto.py): `wordwinnow/application/dto.py`
- [Facts worker](https://github.com/wordbench/wordwinnow/blob/main/wordwinnow/services/workers.py): `wordwinnow/services/workers.py`

### Other components

- **Learner**

## Connections

- Learner → CLI: provides text and profile (evidence: `README.md`)
- CLI → Intake API: submits analysis (evidence: `README.md`)
- Intake API → Document acquisition: acquires document (evidence: `wordwinnow/services/intake/app.py`)
- Document acquisition → Custom text: reads custom text
- Document acquisition → NYT sources: fetches articles
- Intake API → Request analysis: requests analysis (evidence: `wordwinnow/services/intake/app.py`)
- Request analysis → Analysis repository: stores request
- Request analysis → Message bus: publishes request
- Message bus → Analysis worker: delivers message (evidence: `wordwinnow/services/workers.py`)
- Analysis worker → Process analysis: runs pipeline (evidence: `wordwinnow/services/workers.py`)
- Process analysis → Linguistic analysis: analyzes text
- Process analysis → Lexical semantics: retrieves senses
- Process analysis → Level assessment: assesses levels (evidence: `wordwinnow/application/use_cases/process_an_analysis.py`)
- Process analysis → Level model: predicts levels
- Process analysis → Dictionary enrichment: looks up meanings
- Process analysis → Study winnowing: places vocabulary (evidence: `README.md`)
- Process analysis → Analysis lifecycle: completes lifecycle (evidence: `wordwinnow/application/use_cases/process_an_analysis.py`)
- Process analysis → Analysis repository: persists result
- Intake API → Analysis repository: reads analysis
- CLI → Reports: renders result (evidence: `wordwinnow/services/cli/main.py`)
- Analysis lifecycle → Vocabulary facts: derives facts (evidence: `wordwinnow/application/dto.py`)
- Analysis worker → Facts worker: records completed facts (evidence: `wordwinnow/services/workers.py`)
- Facts worker → Vocabulary facts: builds facts (evidence: `wordwinnow/services/workers.py`)
- Facts worker → Analytics store: records facts
