# geshna-b/plagiarism-detection-system architecture

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

- Interactive diagram: https://gitdiagram.com/geshna-b/plagiarism-detection-system
- Repository: https://github.com/geshna-b/plagiarism-detection-system

## Overview

The repository implements a hybrid plagiarism detector with a Flask dashboard and a command-line workflow. In both, submitted text is compared with topic-related Wikipedia material using Aho–Corasick matching, then turned into a report; the dashboard also accepts uploads and supports report downloads. The README describes semantic comparison and evaluation metrics, but the sampled detector implements exact pattern matching, so those capabilities are not represented as verified runtime stages. Some dashboard and preprocessing details are unsampled; uncertain links are omitted.

Main entry points: [`code/app.py`](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/app.py) (Flask dashboard), [`code/main.py`](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/main.py) (CLI workflow), [`code/detectors/llm_integration.py`](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/llm_integration.py) (Topic and Wikipedia integration), [`code/detectors/automata_detector.py`](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/automata_detector.py) (Plagiarism detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_web["Flask dashboard<br/>[app.py]"]
  node_webui["Dashboard template<br/>[index.html]"]
  node_cli["CLI workflow<br/>[main.py]"]
end

subgraph group_collection["Topic and source collection"]
  node_llm["Topic and Wikipedia integration<br/>[llm_integration.py]"]
  node_groq{{"Groq LLM"}}
  node_wikipedia{{"Wikipedia"}}
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_detection["Text detection"]
  node_detector["Plagiarism detector"]
  node_processor["Text preprocessing<br/>[text_processor.py]"]
end

subgraph group_reporting["Results and reports"]
  node_reporter["Report generation<br/>[reporting.py]"]
  node_reportfile["JSON report output"]
end

node_user(("User"))

node_user -->|"submits text"| node_web
node_webui -.->|"sends requests"| node_web
node_user -->|"provides text"| node_cli
node_web -->|"collects sources"| node_llm
node_web -->|"checks text"| node_detector
node_web -->|"generates report"| node_reporter
node_cli -->|"expands and fetches"| node_llm
node_cli -->|"checks text"| node_detector
node_cli -->|"generates report"| node_reporter
node_llm -->|"validates settings"| node_config
node_llm -->|"invokes model"| node_groq
node_llm -->|"fetches content"| node_wikipedia
node_detector -->|"normalizes and tokenizes"| node_processor
node_web -->|"downloads JSON"| node_reportfile
node_cli -->|"saves JSON"| node_reportfile

click node_web "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/app.py"
click node_webui "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/templates/index.html"
click node_cli "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/main.py"
click node_llm "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/llm_integration.py"
click node_config "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/utils/config.py"
click node_detector "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/automata_detector.py"
click node_processor "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/text_processor.py"
click node_reporter "https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/utils/reporting.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_web,node_webui,node_cli,node_user toneBlue
class node_llm,node_groq,node_wikipedia,node_config toneAmber
class node_detector,node_processor toneMint
class node_reporter,node_reportfile toneRose
```

## Components

### User entry points

- [Flask dashboard](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/app.py): `code/app.py`
- [Dashboard template](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/templates/index.html): `code/templates/index.html`
- [CLI workflow](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/main.py): `code/main.py`

### Topic and source collection

- [Topic and Wikipedia integration](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/llm_integration.py): `code/detectors/llm_integration.py`
- **Groq LLM**
- **Wikipedia**
- [Runtime configuration](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/utils/config.py): `code/utils/config.py`

### Text detection

- [Plagiarism detector](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/automata_detector.py): `code/detectors/automata_detector.py`
- [Text preprocessing](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/detectors/text_processor.py): `code/detectors/text_processor.py`

### Results and reports

- [Report generation](https://github.com/geshna-b/plagiarism-detection-system/blob/main/code/utils/reporting.py): `code/utils/reporting.py`
- **JSON report output**

### Other components

- **User**

## Connections

- User → Flask dashboard: submits text (evidence: `code/app.py`)
- Dashboard template → Flask dashboard: sends requests
- User → CLI workflow: provides text (evidence: `code/main.py`)
- Flask dashboard → Topic and Wikipedia integration: collects sources (evidence: `code/app.py`)
- Flask dashboard → Plagiarism detector: checks text (evidence: `code/app.py`)
- Flask dashboard → Report generation: generates report (evidence: `code/app.py`)
- CLI workflow → Topic and Wikipedia integration: expands and fetches (evidence: `code/main.py`)
- CLI workflow → Plagiarism detector: checks text (evidence: `code/main.py`)
- CLI workflow → Report generation: generates report (evidence: `code/main.py`)
- Topic and Wikipedia integration → Runtime configuration: validates settings (evidence: `code/detectors/llm_integration.py`)
- Topic and Wikipedia integration → Groq LLM: invokes model (evidence: `code/detectors/llm_integration.py`)
- Topic and Wikipedia integration → Wikipedia: fetches content (evidence: `code/detectors/llm_integration.py`)
- Plagiarism detector → Text preprocessing: normalizes and tokenizes (evidence: `code/detectors/automata_detector.py`)
- Flask dashboard → JSON report output: downloads JSON (evidence: `code/app.py`)
- CLI workflow → JSON report output: saves JSON (evidence: `code/main.py`)
