# saad056/cyberpolice architecture

> Architecture diagram of the GitHub repository saad056/cyberpolice, 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/saad056/cyberpolice
- Repository: https://github.com/saad056/cyberpolice

## Overview

This repository is a research prototype for detecting cyberbullying in Twitter text. Its documented main workflow is to train neural models on the bundled Twitter dataset and generate precision, recall, and F1 results. The model factory provides several architectures, including the README’s LSTM and bidirectional-attention variants, plus a CNN. The repository also contains embedding and data-analysis notebooks; their implementation details and connections are not shown in the sampled source, so they are represented without inferred flows.

Main entry points: [`models.py`](https://github.com/saad056/cyberpolice/blob/main/models.py) (Model selector), [`DNNs.ipynb`](https://github.com/saad056/cyberpolice/blob/main/DNNs.ipynb) (DNN training), [`data/twitter_data.pkl`](https://github.com/saad056/cyberpolice/blob/main/data/twitter_data.pkl) (Twitter dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and exploration"]
  node_twitter_data["Twitter dataset<br/>[twitter_data.pkl]"]
  node_data_analysis["Data analysis"]
  node_embedding_notebook["Embedding notebook<br/>[Embedding.ipynb]"]
end

subgraph group_models["Modeling"]
  node_training_notebook["DNN training<br/>[DNNs.ipynb]"]
  node_model_factory["Model selector<br/>[models.py]"]
  node_lstm["LSTM models<br/>[models.py]"]
  node_attention_models["BiLSTM attention<br/>[models.py]"]
  node_cnn["CNN model<br/>[models.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Precision, recall, F1<br/>[DNNs.ipynb]"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs training"| node_training_notebook
node_twitter_data -->|"trains on"| node_training_notebook
node_training_notebook -->|"uses architectures"| node_model_factory
node_model_factory -->|"selects"| node_lstm
node_model_factory -->|"selects"| node_attention_models
node_model_factory -->|"selects"| node_cnn
node_training_notebook -->|"generates metrics"| node_metrics

click node_twitter_data "https://github.com/saad056/cyberpolice/blob/main/data/twitter_data.pkl"
click node_data_analysis "https://github.com/saad056/cyberpolice/blob/main/data_analysis/DataAnalysisTwitter.ipynb"
click node_embedding_notebook "https://github.com/saad056/cyberpolice/blob/main/Embedding.ipynb"
click node_training_notebook "https://github.com/saad056/cyberpolice/blob/main/DNNs.ipynb"
click node_model_factory "https://github.com/saad056/cyberpolice/blob/main/models.py"
click node_lstm "https://github.com/saad056/cyberpolice/blob/main/models.py"
click node_attention_models "https://github.com/saad056/cyberpolice/blob/main/models.py"
click node_cnn "https://github.com/saad056/cyberpolice/blob/main/models.py"
click node_metrics "https://github.com/saad056/cyberpolice/blob/main/DNNs.ipynb"

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_twitter_data,node_data_analysis,node_embedding_notebook toneBlue
class node_training_notebook,node_model_factory,node_lstm,node_attention_models,node_cnn toneAmber
class node_metrics toneMint
class node_researcher toneIndigo
```

## Components

### Data and exploration

- [Twitter dataset](https://github.com/saad056/cyberpolice/blob/main/data/twitter_data.pkl): `data/twitter_data.pkl`
- [Data analysis](https://github.com/saad056/cyberpolice/blob/main/data_analysis/DataAnalysisTwitter.ipynb): `data_analysis/DataAnalysisTwitter.ipynb`
- [Embedding notebook](https://github.com/saad056/cyberpolice/blob/main/Embedding.ipynb): `Embedding.ipynb`

### Modeling

- [DNN training](https://github.com/saad056/cyberpolice/blob/main/DNNs.ipynb): `DNNs.ipynb`
- [Model selector](https://github.com/saad056/cyberpolice/blob/main/models.py): `models.py`
- [LSTM models](https://github.com/saad056/cyberpolice/blob/main/models.py): `models.py`
- [BiLSTM attention](https://github.com/saad056/cyberpolice/blob/main/models.py): `models.py`
- [CNN model](https://github.com/saad056/cyberpolice/blob/main/models.py): `models.py`

### Evaluation

- [Precision, recall, F1](https://github.com/saad056/cyberpolice/blob/main/DNNs.ipynb): `DNNs.ipynb`

### Other components

- **Researcher**

## Connections

- Researcher → DNN training: runs training (evidence: `README.md`)
- Twitter dataset → DNN training: trains on (evidence: `README.md`)
- DNN training → Model selector: uses architectures (evidence: `README.md`)
- Model selector → LSTM models: selects (evidence: `models.py`)
- Model selector → BiLSTM attention: selects (evidence: `models.py`)
- Model selector → CNN model: selects (evidence: `models.py`)
- DNN training → Precision, recall, F1: generates metrics (evidence: `README.md`)
