# kapilcyber/chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/kapilcyber/chatbot
- Repository: https://github.com/kapilcyber/chatbot

## Overview

##### Project type and purpose
- This is a standalone data-science chatbot project in Python.
- It includes an offline training pipeline (“train_chatbot.py”), model artifacts (chatbot_model.h5, words.pkl, classes.pkl), a JSON knowledge base (intents.json), and a GUI inference script (“gui_chatbot.py”).

##### File structure
- train_chatbot.py – script to preprocess data (intents.json → tokenized words, classes) and train a neural-network model (Keras)
- chatbot_model.h5 – the serialized Keras model
- words.pkl, classes.pkl – pickled vocabularies and label encodings produced by training
- intents.json – the corpus of user intents, example patterns, and response templates
- gui_chatbot.py – GUI front end for runtime inference (likely using Tkinter or similar)
- README.md / .gitignore – project metadata and VCS ignores

##### README
- Confirms that this is a data science demonstration of a chatbot. No further architectural notes.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Offline Training Pipeline"
        Data["intents.json"]:::data
        Train["train_chatbot.py"]:::offline
        Words["words.pkl"]:::artifact
        Classes["classes.pkl"]:::artifact
        Model["chatbot_model.h5"]:::artifact

        Data -->|"preprocess"| Train
        Train -->|"serialize vocab"| Words
        Train -->|"serialize labels"| Classes
        Train -->|"train model"| Model
    end

    subgraph "Runtime Chatbot Application"
        GUI["GUI Window"]:::ui
        Infer["Runtime Inference Engine"]:::runtime

        GUI -->|"user input"| Infer
        Infer -->|"predict intent"| Infer
        Infer -->|"generate response"| GUI

        Model -->|"load model"| Infer
        Words -->|"load vocab"| Infer
        Classes -->|"load labels"| Infer
        Data -->|"load templates"| Infer
    end

    click Data "https://github.com/kapilcyber/chatbot/blob/main/intents.json"
    click Train "https://github.com/kapilcyber/chatbot/blob/main/train_chatbot.py"
    click Words "https://github.com/kapilcyber/chatbot/blob/main/words.pkl"
    click Classes "https://github.com/kapilcyber/chatbot/blob/main/classes.pkl"
    click Model "https://github.com/kapilcyber/chatbot/blob/main/chatbot_model.h5"
    click Infer "https://github.com/kapilcyber/chatbot/blob/main/gui_chatbot.py"
    click GUI "https://github.com/kapilcyber/chatbot/blob/main/gui_chatbot.py"

    classDef data fill:#f9f,stroke:#333,stroke-width:1px
    classDef offline fill:#bbf,stroke:#333,stroke-width:1px
    classDef runtime fill:#bfb,stroke:#333,stroke-width:1px
    classDef artifact fill:#ffe066,stroke:#333,stroke-width:1px
    classDef ui fill:#f6f,stroke:#333,stroke-width:1px
```
