# ahmedsamy02/nlp-project architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedsamy02/nlp-project
- Repository: https://github.com/ahmedsamy02/nlp-project

## Overview

##### Project type and purpose
- This is an NLP research/prototype project (“Pizza Order Parsing System”) implemented as a series of Jupyter notebooks and scripts.
- Purpose: take free‐form pizza‐order text, preprocess it, run two sequential neural models (order classification + entity recognition), then output a structured JSON parse tree.

##### File structure
- Top‐level notebooks correspond to pipeline stages:
- preprocessing.ipynb – data cleaning, negation handling, abbreviation expansion
- classification_relations.ipynb – order‐boundary classification model
- enc-dec.ipynb & encoder-decoder.ipynb – experimentation with encoder–decoder architectures
- “final codes/” contains the demo pipeline and final‐model notebook.
- “sample_input_output/” holds example input.txt and output.json.
- No traditional “src/” directory; each notebook encapsulates a module.

##### README for insights
- Pipeline stages: Data Preprocessing → Order Classification Model → Entity Recognition Model → Parse‐tree generation.
- Key technologies: Python, Jupyter, FastText embeddings, Bidirectional LSTM (Keras/TensorFlow), regex labeling, RMSprop/Adam optimizers.
- Dataset: Amazon Pizza Order dataset (2.4M samples), with 500K‐sample training subsets for each model.

##### Detail without over-fragmentation
- Distinct pipeline stage as its own component.
- Both training and inference flows if needed.
- Do not split beyond preprocessing, classification, entity recognition, and parse generation modules.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Layer
    RawDataset[(Raw Pizza Order Dataset)]:::data
    SampleInput["input.txt"]:::data

    %% Processing Stages
    Preprocessing["Preprocessing Module"]:::processing
    OrderClassification["Order Classification\n(BiLSTM)"]:::model
    subgraph "Entity Recognition Model"
        EncDec["enc-dec.ipynb"]:::model
        EncoderDecoder["encoder-decoder.ipynb"]:::model
    end
    ParseTreeGen["Parse-Tree Generator\n(Demo Pipeline)"]:::processing
    JSONOutput["output.json"]:::data

    %% Archived Components
    subgraph "Archived Modules"
        OldPreproc["preprocessing.ipynb"]:::processing
        OldClassif["classification_ml.ipynb"]:::model
        subgraph "Old Encoder-Decoder Experiments"
            OldEncBest["encoder-decoder-best.ipynb"]:::model
            OldEncRaw["encoder-decoder-raw-input.ipynb"]:::model
        end
    end

    %% Data Flow
    RawDataset -->|raw text| Preprocessing
    SampleInput -->|example text| Preprocessing
    Preprocessing -->|"tokenized text"| OrderClassification
    OrderClassification -->|"class labels"| EncDec
    OrderClassification -->|"class labels"| EncoderDecoder
    EncDec -->|"tagged sequences"| ParseTreeGen
    EncoderDecoder -->|"tagged sequences"| ParseTreeGen
    ParseTreeGen -->|"JSON tree"| JSONOutput

    %% Click Events
    click Preprocessing "https://github.com/ahmedsamy02/nlp-project/blob/main/preprocessing.ipynb"
    click OrderClassification "https://github.com/ahmedsamy02/nlp-project/blob/main/classification_relations.ipynb"
    click EncDec "https://github.com/ahmedsamy02/nlp-project/blob/main/enc-dec.ipynb"
    click EncoderDecoder "https://github.com/ahmedsamy02/nlp-project/blob/main/encoder-decoder.ipynb"
    click ParseTreeGen "https://github.com/ahmedsamy02/nlp-project/blob/main/final codes/demo.ipynb"
    click JSONOutput "https://github.com/ahmedsamy02/nlp-project/blob/main/sample_input_output/output.json"
    click SampleInput "https://github.com/ahmedsamy02/nlp-project/blob/main/sample_input_output/input.txt"
    click OldPreproc "https://github.com/ahmedsamy02/nlp-project/blob/main/final codes/oldCodes/preprocessing.ipynb"
    click OldClassif "https://github.com/ahmedsamy02/nlp-project/blob/main/final codes/oldCodes/classification_ml.ipynb"
    click OldEncBest "https://github.com/ahmedsamy02/nlp-project/blob/main/final codes/oldCodes/encoder-decoder-best.ipynb"
    click OldEncRaw "https://github.com/ahmedsamy02/nlp-project/blob/main/final codes/oldCodes/encoder-decoder-raw-input.ipynb"

    %% Styles
    classDef data fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef processing fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20
    classDef model fill:#ffe0b2,stroke:#ef6c00,color:#e65100
```
