# jasonwei20/eda_nlp architecture

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

- Interactive diagram: https://gitdiagram.com/jasonwei20/eda_nlp
- Repository: https://github.com/jasonwei20/eda_nlp

## Overview

This repository implements Easy Data Augmentation (EDA) for labeled text-classification data, alongside paper experiments and dataset preparation. The main user workflow reads label–sentence rows, applies configurable text edits, and writes augmented rows; experiments then prepare data, train classifiers, and evaluate results. The graph preserves the four documented edit techniques and the experiment families. Some subsystem links are based on the SOURCE INDEX or README rather than full excerpts, so unsampled implementation details are not inferred.

Main entry points: [`experiments/methods.py`](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/methods.py) (Shared experiment methods), [`code/eda.py`](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py) (EDA generation), [`code/augment.py`](https://github.com/jasonwei20/eda_nlp/blob/master/code/augment.py) (Augmentation CLI), [`experiments/a_2_train_eval.py`](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/a_2_train_eval.py) (Experiment A)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_augmentation["EDA augmentation"]
  node_cli["Augmentation CLI<br/>[augment.py]"]
  node_eda_core["EDA generation<br/>[eda.py]"]
  node_sr["Synonym replacement<br/>[eda.py]"]
  node_ri["Random insertion<br/>[eda.py]"]
  node_rs["Random swap<br/>[eda.py]"]
  node_rd["Random deletion<br/>[eda.py]"]
end

subgraph group_preparation["Dataset preparation"]
  node_text_cleaning["Dataset cleaning"]
  node_sst_cleaner["SST label and split<br/>[sst1_clean.py]"]
  node_clean_utils["Text normalization<br/>[utils.py]"]
  node_bg_cleaner["BG dataset cleaner<br/>[bg_clean.py]"]
end

subgraph group_experiments["Research experiments"]
  node_experiment_methods["Shared experiment methods<br/>[methods.py]"]
  node_nlp_aug["Experiment augmentation<br/>[nlp_aug.py]"]
  node_family_a["Experiment A<br/>[a_2_train_eval.py]"]
  node_config_a["A configuration<br/>[a_config.py]"]
  node_family_b["Experiment B<br/>[b_2_train_eval.py]"]
  node_config_b["B configuration<br/>[b_config.py]"]
  node_family_c["Experiment C<br/>[c_2_train_eval.py]"]
  node_config_c["C configuration<br/>[c_config.py]"]
  node_family_d["Experiment D"]
  node_family_e["CNN and RNN experiments<br/>[e_2_cnn_aug.py]"]
  node_config_e["E configuration<br/>[e_config.py]"]
end

subgraph group_modeling["Modeling and analysis"]
  node_tsne["Embedding visualization<br/>[d_2_tsne.py]"]
end

node_user(("Dataset user"))
node_labeled_data["Labeled text"]
node_wordnet["NLTK WordNet"]
node_augmented_data["Augmented rows"]

node_user -->|"runs"| node_cli
node_labeled_data -->|"provides rows"| node_cli
node_cli -->|"calls"| node_eda_core
node_eda_core -->|"applies"| node_sr
node_eda_core -->|"applies"| node_ri
node_eda_core -->|"applies"| node_rs
node_eda_core -->|"applies"| node_rd
node_sr -->|"looks up synonyms"| node_wordnet
node_ri -->|"looks up synonyms"| node_wordnet
node_eda_core -->|"writes rows"| node_augmented_data
node_text_cleaning -->|"uses"| node_clean_utils
node_sst_cleaner -->|"uses"| node_clean_utils
node_family_a -->|"imports methods"| node_experiment_methods
node_family_a -->|"imports config"| node_config_a
node_family_b -->|"uses methods"| node_experiment_methods
node_family_b -->|"uses config"| node_config_b
node_family_c -->|"imports methods"| node_experiment_methods
node_family_c -->|"imports config"| node_config_c
node_experiment_methods -->|"imports augmentation"| node_nlp_aug
node_family_d -->|"uses methods"| node_experiment_methods
node_tsne -->|"imports methods"| node_experiment_methods
node_family_e -->|"uses methods"| node_experiment_methods
node_family_e -->|"uses config"| node_config_e

click node_labeled_data "https://github.com/jasonwei20/eda_nlp/tree/master/data"
click node_cli "https://github.com/jasonwei20/eda_nlp/blob/master/code/augment.py"
click node_eda_core "https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py"
click node_sr "https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py"
click node_ri "https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py"
click node_rs "https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py"
click node_rd "https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py"
click node_text_cleaning "https://github.com/jasonwei20/eda_nlp/tree/master/preprocess"
click node_sst_cleaner "https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/sst1_clean.py"
click node_clean_utils "https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/utils.py"
click node_bg_cleaner "https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/bg_clean.py"
click node_experiment_methods "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/methods.py"
click node_nlp_aug "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/nlp_aug.py"
click node_family_a "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/a_2_train_eval.py"
click node_config_a "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/a_config.py"
click node_family_b "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/b_2_train_eval.py"
click node_config_b "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/b_config.py"
click node_family_c "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/c_2_train_eval.py"
click node_config_c "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/c_config.py"
click node_family_d "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/d_1_train_models.py"
click node_tsne "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/d_2_tsne.py"
click node_family_e "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/e_2_cnn_aug.py"
click node_config_e "https://github.com/jasonwei20/eda_nlp/blob/master/experiments/e_config.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_eda_core,node_sr,node_ri,node_rs,node_rd,node_user toneBlue
class node_text_cleaning,node_sst_cleaner,node_clean_utils,node_bg_cleaner toneAmber
class node_experiment_methods,node_nlp_aug,node_family_a,node_config_a,node_family_b,node_config_b,node_family_c,node_config_c,node_family_d,node_family_e,node_config_e toneMint
class node_tsne toneRose
class node_labeled_data toneTeal
class node_wordnet,node_augmented_data toneIndigo
```

## Components

### EDA augmentation

- [Augmentation CLI](https://github.com/jasonwei20/eda_nlp/blob/master/code/augment.py): `code/augment.py`
- [EDA generation](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py): `code/eda.py`
- [Synonym replacement](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py): `code/eda.py`
- [Random insertion](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py): `code/eda.py`
- [Random swap](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py): `code/eda.py`
- [Random deletion](https://github.com/jasonwei20/eda_nlp/blob/master/code/eda.py): `code/eda.py`

### Dataset preparation

- [Dataset cleaning](https://github.com/jasonwei20/eda_nlp/tree/master/preprocess): `preprocess`
- [SST label and split](https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/sst1_clean.py): `preprocess/sst1_clean.py`
- [Text normalization](https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/utils.py): `preprocess/utils.py`
- [BG dataset cleaner](https://github.com/jasonwei20/eda_nlp/blob/master/preprocess/bg_clean.py): `preprocess/bg_clean.py`

### Research experiments

- [Shared experiment methods](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/methods.py): `experiments/methods.py`
- [Experiment augmentation](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/nlp_aug.py): `experiments/nlp_aug.py`
- [Experiment A](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/a_2_train_eval.py): `experiments/a_2_train_eval.py`
- [A configuration](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/a_config.py): `experiments/a_config.py`
- [Experiment B](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/b_2_train_eval.py): `experiments/b_2_train_eval.py`
- [B configuration](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/b_config.py): `experiments/b_config.py`
- [Experiment C](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/c_2_train_eval.py): `experiments/c_2_train_eval.py`
- [C configuration](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/c_config.py): `experiments/c_config.py`
- [Experiment D](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/d_1_train_models.py): `experiments/d_1_train_models.py`
- [CNN and RNN experiments](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/e_2_cnn_aug.py): `experiments/e_2_cnn_aug.py`
- [E configuration](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/e_config.py): `experiments/e_config.py`

### Modeling and analysis

- [Embedding visualization](https://github.com/jasonwei20/eda_nlp/blob/master/experiments/d_2_tsne.py): `experiments/d_2_tsne.py`

### Other components

- **Dataset user**
- [Labeled text](https://github.com/jasonwei20/eda_nlp/tree/master/data): `data`
- **NLTK WordNet**
- **Augmented rows**

## Connections

- Dataset user → Augmentation CLI: runs (evidence: `README.md`)
- Labeled text → Augmentation CLI: provides rows (evidence: `README.md`)
- Augmentation CLI → EDA generation: calls (evidence: `code/augment.py`)
- EDA generation → Synonym replacement: applies (evidence: `README.md`)
- EDA generation → Random insertion: applies (evidence: `README.md`)
- EDA generation → Random swap: applies (evidence: `README.md`)
- EDA generation → Random deletion: applies (evidence: `README.md`)
- Synonym replacement → NLTK WordNet: looks up synonyms (evidence: `code/eda.py`)
- Random insertion → NLTK WordNet: looks up synonyms (evidence: `code/eda.py`)
- EDA generation → Augmented rows: writes rows
- Dataset cleaning → Text normalization: uses (evidence: `preprocess/bg_clean.py`)
- SST label and split → Text normalization: uses (evidence: `preprocess/sst1_clean.py`)
- Experiment A → Shared experiment methods: imports methods (evidence: `experiments/a_2_train_eval.py`)
- Experiment A → A configuration: imports config (evidence: `experiments/a_2_train_eval.py`)
- Experiment B → Shared experiment methods: uses methods (evidence: `experiments/b_2_train_eval.py`)
- Experiment B → B configuration: uses config (evidence: `experiments/b_2_train_eval.py`)
- Experiment C → Shared experiment methods: imports methods (evidence: `experiments/c_2_train_eval.py`)
- Experiment C → C configuration: imports config (evidence: `experiments/c_2_train_eval.py`)
- Shared experiment methods → Experiment augmentation: imports augmentation (evidence: `experiments/methods.py`)
- Experiment D → Shared experiment methods: uses methods (evidence: `experiments/d_1_train_models.py`)
- Embedding visualization → Shared experiment methods: imports methods (evidence: `experiments/d_2_tsne.py`)
- CNN and RNN experiments → Shared experiment methods: uses methods (evidence: `experiments/e_2_cnn_aug.py`)
- CNN and RNN experiments → E configuration: uses config (evidence: `experiments/e_2_cnn_aug.py`)
