# atbaker/wikipedia-question-generator architecture

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

- Interactive diagram: https://gitdiagram.com/atbaker/wikipedia-question-generator
- Repository: https://github.com/atbaker/wikipedia-question-generator

## Overview

##### Project type and purpose
- This is an open-source, Python-based command-line tool (“wikipedia-question-generator” a.k.a. “wikitrivia”) that:
- Fetches Wikipedia article summaries
- Applies NLP (via TextBlob/NLTK/WordNet)
- Generates Mad-Libs-style trivia questions with decoy answers
- It can be installed as a Python CLI or run in a Docker container.

##### File structure
Top level:
- Dockerfile + docker-compose.yml → containerized deployment
- setup.py + requirements.txt → Python package metadata & dependencies
- default.json → sample/default configuration
- README.md + LICENSE + .gitignore → documentation & licensing
Package “wikitrivia/”:
- __init__.py → package entry point
- article.py → core logic: fetch & parse Wiki summary, blank nouns, create decoys
- scripts/wikitrivia.py → Click-based CLI wrapper around article.py

##### README for additional insights
- Uses Click for CLI
- Two deployment modes: Python venv or Docker
- Methodology broken into: summary extraction, sentence filtering, blanking nouns, decoy generation via WordNet hyponyms

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User["User / Shell"]:::external

    %% Containerization Layer
    subgraph "Docker Container"
        direction TB
        CLI["CLI Command\n(wikitrivia)"]:::internal
        Entry["Package Entry Point\n(__init__.py)"]:::internal
        Config["Configuration\n(default.json)"]:::config
        Metadata["Package Metadata\n(setup.py,\nrequirements.txt)"]:::config
        Fetch["Wikipedia Fetcher\n(article.py)"]:::internal
        subgraph "NLP Processor"
            direction TB
            SE["Sentence Extractor & Filter"]:::internal
            BM["Blank-n-Mask Module"]:::internal
            DG["Decoy Generator"]:::internal
        end
        Output["Output Formatter"]:::internal
    end

    %% External Dependencies & Services
    WPAPI["Wikipedia REST API"]:::external
    TB["TextBlob / NLTK / WordNet"]:::external

    %% Documentation
    README["README.md"]:::doc
    LICENSE["LICENSE"]:::doc

    %% Connections
    User --> CLI
    CLI --> Config
    CLI --> Metadata
    CLI --> Entry
    CLI --> Fetch
    Fetch --> WPAPI
    Fetch --> SE
    SE --> BM
    BM --> DG
    DG --> Output
    Output --> User

    %% NLP depends on NLP libraries
    TB --> SE
    TB --> BM
    TB --> DG

    %% Click Events
    click CLI "https://github.com/atbaker/wikipedia-question-generator/blob/master/wikitrivia/scripts/wikitrivia.py"
    click Entry "https://github.com/atbaker/wikipedia-question-generator/blob/master/wikitrivia/__init__.py"
    click Config "https://github.com/atbaker/wikipedia-question-generator/blob/master/default.json"
    click Metadata "https://github.com/atbaker/wikipedia-question-generator/blob/master/setup.py"
    click Metadata "https://github.com/atbaker/wikipedia-question-generator/blob/master/requirements.txt"
    click Fetch "https://github.com/atbaker/wikipedia-question-generator/blob/master/wikitrivia/article.py"
    click README "https://github.com/atbaker/wikipedia-question-generator/blob/master/README.md"
    click LICENSE "https://github.com/atbaker/wikipedia-question-generator/tree/master/LICENSE"

    %% Styles
    classDef internal fill:#D6EAF8,stroke:#1B4F72,stroke-width:1px
    classDef external fill:#F2F4F4,stroke:#85929E,stroke-width:1px,stroke-dasharray: 5 5
    classDef config fill:#FCF3CF,stroke:#B7950B,stroke-width:1px
    classDef infra fill:#FADBD8,stroke:#922B21,stroke-width:1px
    classDef doc fill:#D5F5E3,stroke:#1D8348,stroke-width:1px
```
