# positivepeng/nlp-beginner-projects architecture

> Architecture diagram of the GitHub repository positivepeng/nlp-beginner-projects, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/positivepeng/nlp-beginner-projects
- Repository: https://github.com/positivepeng/nlp-beginner-projects

## Overview

This repository is a collection of five standalone PyTorch/ML NLP examples, rather than one shared application. Their workflows cover bag-of-words and n-gram softmax classification; RNN/CNN classification; BiLSTM-CRF entity tagging; attention-capable date translation; and poetry generation. Each project has its own entry point, data preparation, and model code. The graph follows the sampled entry points and loaders; model implementations are represented by their exact tree paths, but their internal wiring was not sampled.

Main entry points: [`project1-ML-Sentence Classification/main.py`](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/main.py) (ML workflow), [`project2-DL-Sentence Classification/main.py`](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/main.py) (DL workflow), [`project3-Named Entity Recognition/main.py`](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/main.py) (NER workflow), [`project3-Named Entity Recognition/models.py`](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/models.py) (BiLSTM-CRF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ml["Feature Classification"]
  node_ml_main["ML workflow<br/>[main.py]"]
  node_ml_data["Read reviews<br/>[data_preprocess.py]"]
  node_ml_features["BOW / n-grams"]
  node_ml_model["Softmax model"]
  node_ml_result["Class scores"]
end

subgraph group_dl["Neural Classification"]
  node_dl_main["DL workflow<br/>[main.py]"]
  node_dl_torchtext["TorchText loader"]
  node_dl_hand["Manual loader"]
  node_dl_models["RNN / CNN<br/>[models.py]"]
  node_dl_result["Class predictions"]
end

subgraph group_ner["Entity Recognition"]
  node_ner_main["NER workflow<br/>[main.py]"]
  node_ner_data["Tagged data loader<br/>[dataloader.py]"]
  node_ner_model["BiLSTM-CRF<br/>[models.py]"]
  node_crf["CRF decoder<br/>[__init__.py]"]
  node_ner_result["Entity tags"]
end

subgraph group_mt["Date Translation"]
  node_mt_main["Translation workflow<br/>[main.py]"]
  node_mt_data["Date data loader<br/>[dataloader.py]"]
  node_mt_model["Seq2Seq model<br/>[models.py]"]
  node_mt_result["Normalized date"]
end

subgraph group_poetry["Poetry Generation"]
  node_poetry_main["Generation workflow<br/>[main.py]"]
  node_poetry_data["Poetry loader<br/>[dataloader.py]"]
  node_poetry_model["Poetry model<br/>[models.py]"]
  node_poetry_result["Generated poem"]
end

node_user(("Example user"))

node_user -->|"starts example"| node_ml_main
node_ml_main -->|"reads reviews"| node_ml_data
node_ml_main -->|"builds features"| node_ml_features
node_ml_main -->|"trains / scores"| node_ml_model
node_ml_model -->|"predicts labels"| node_ml_result
node_user -->|"starts example"| node_dl_main
node_dl_main -->|"selects loader"| node_dl_torchtext
node_dl_main -.->|"optional loader"| node_dl_hand
node_dl_main -->|"trains / evaluates"| node_dl_models
node_dl_models -->|"classifies text"| node_dl_result
node_user -->|"starts example"| node_ner_main
node_ner_main -->|"loads batches"| node_ner_data
node_ner_main -->|"trains / predicts"| node_ner_model
node_ner_model -->|"uses decoding"| node_crf
node_ner_model -->|"returns tags"| node_ner_result
node_user -->|"starts example"| node_mt_main
node_mt_main -->|"loads date pairs"| node_mt_data
node_mt_main -->|"trains / translates"| node_mt_model
node_mt_model -->|"generates date"| node_mt_result
node_user -->|"starts example"| node_poetry_main
node_poetry_main -->|"loads poems"| node_poetry_data
node_poetry_main -->|"trains / generates"| node_poetry_model
node_poetry_model -->|"generates text"| node_poetry_result

click node_ml_main "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/main.py"
click node_ml_data "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/data_preprocess.py"
click node_ml_features "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/feature_extraction.py"
click node_ml_model "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/softmax_regerssion.py"
click node_dl_main "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/main.py"
click node_dl_torchtext "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/dataloader_bytorchtext.py"
click node_dl_hand "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/dataloader_byhand.py"
click node_dl_models "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/models.py"
click node_ner_main "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/main.py"
click node_ner_data "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/dataloader.py"
click node_ner_model "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/models.py"
click node_crf "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/torchcrf/__init__.py"
click node_mt_main "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/main.py"
click node_mt_data "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/dataloader.py"
click node_mt_model "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/models.py"
click node_poetry_main "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/main.py"
click node_poetry_data "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/dataloader.py"
click node_poetry_model "https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/models.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_ml_main,node_ml_data,node_ml_features,node_ml_model,node_ml_result,node_user toneBlue
class node_dl_main,node_dl_torchtext,node_dl_hand,node_dl_models,node_dl_result toneAmber
class node_ner_main,node_ner_data,node_ner_model,node_crf,node_ner_result toneMint
class node_mt_main,node_mt_data,node_mt_model,node_mt_result toneRose
class node_poetry_main,node_poetry_data,node_poetry_model,node_poetry_result toneIndigo
```

## Components

### Feature Classification

- [ML workflow](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/main.py): `project1-ML-Sentence Classification/main.py`
- [Read reviews](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/data_preprocess.py): `project1-ML-Sentence Classification/data_preprocess.py`
- [BOW / n-grams](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/feature_extraction.py): `project1-ML-Sentence Classification/feature_extraction.py`
- [Softmax model](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project1-ML-Sentence%20Classification/softmax_regerssion.py): `project1-ML-Sentence Classification/softmax_regerssion.py`
- **Class scores**

### Neural Classification

- [DL workflow](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/main.py): `project2-DL-Sentence Classification/main.py`
- [TorchText loader](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/dataloader_bytorchtext.py): `project2-DL-Sentence Classification/dataloader_bytorchtext.py`
- [Manual loader](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/dataloader_byhand.py): `project2-DL-Sentence Classification/dataloader_byhand.py`
- [RNN / CNN](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project2-DL-Sentence%20Classification/models.py): `project2-DL-Sentence Classification/models.py`
- **Class predictions**

### Entity Recognition

- [NER workflow](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/main.py): `project3-Named Entity Recognition/main.py`
- [Tagged data loader](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/dataloader.py): `project3-Named Entity Recognition/dataloader.py`
- [BiLSTM-CRF](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/models.py): `project3-Named Entity Recognition/models.py`
- [CRF decoder](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project3-Named%20Entity%20Recognition/torchcrf/__init__.py): `project3-Named Entity Recognition/torchcrf/__init__.py`
- **Entity tags**

### Date Translation

- [Translation workflow](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/main.py): `project4-Machine Translation/main.py`
- [Date data loader](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/dataloader.py): `project4-Machine Translation/dataloader.py`
- [Seq2Seq model](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project4-Machine%20Translation/models.py): `project4-Machine Translation/models.py`
- **Normalized date**

### Poetry Generation

- [Generation workflow](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/main.py): `project5-Text Generation/main.py`
- [Poetry loader](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/dataloader.py): `project5-Text Generation/dataloader.py`
- [Poetry model](https://github.com/positivepeng/nlp-beginner-projects/blob/master/project5-Text%20Generation/models.py): `project5-Text Generation/models.py`
- **Generated poem**

### Other components

- **Example user**

## Connections

- Example user → ML workflow: starts example
- ML workflow → Read reviews: reads reviews
- ML workflow → BOW / n-grams: builds features
- ML workflow → Softmax model: trains / scores
- Softmax model → Class scores: predicts labels
- Example user → DL workflow: starts example
- DL workflow → TorchText loader: selects loader
- DL workflow → Manual loader: optional loader
- DL workflow → RNN / CNN: trains / evaluates
- RNN / CNN → Class predictions: classifies text
- Example user → NER workflow: starts example
- NER workflow → Tagged data loader: loads batches
- NER workflow → BiLSTM-CRF: trains / predicts
- BiLSTM-CRF → CRF decoder: uses decoding
- BiLSTM-CRF → Entity tags: returns tags
- Example user → Translation workflow: starts example
- Translation workflow → Date data loader: loads date pairs
- Translation workflow → Seq2Seq model: trains / translates
- Seq2Seq model → Normalized date: generates date
- Example user → Generation workflow: starts example
- Generation workflow → Poetry loader: loads poems
- Generation workflow → Poetry model: trains / generates
- Poetry model → Generated poem: generates text
