# rejonehridoy/emotion_detection_from_text_using_machine_learning architecture

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

- Interactive diagram: https://gitdiagram.com/rejonehridoy/emotion_detection_from_text_using_machine_learning
- Repository: https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning

## Overview

##### Project type and purpose
- This is a standalone machine‐learning/text‐analysis pipeline implemented in a Jupyter notebook (Google Colab) for detecting emotions in tweets.
- It reads a labeled dataset (SemEval-2018 AIT-2018), applies text preprocessing, trains and evaluates six different classifiers, and outputs comparative results.

##### Main components
a. Data Sources
- emojis.txt (emoji‐to‐text mapping)
- text_emotions.csv (AIT-2018 tweets + labels)
b. Preprocessing Module
- Punctuation removal
- Emoji conversion (using emojis.txt)
- Tokenization
- Stopword removal
- Lemmatization
c. Feature Extraction
- TF–IDF vectorizer (or count vectorizer)
d. Model Training & Selection
- Support Vector Machine
- Logistic Regression
- Random Forest
- XGBoost
- Multinomial Naive Bayes
- Decision Tree
e. Evaluation & Comparison
- Accuracy calculation for each model
- Tabular/graphical comparison
f. Artifacts
- Jupyter Notebook (.ipynb)
- Presentation (.pptx)
- Report (.pdf)

##### Relationships and data flows
- Preprocessing → Feature Extraction
- Each Model → Evaluation module
- Evaluation → Final Results (notebook outputs, report, slides)

##### Architectural patterns and technologies
- Linear pipeline pattern: data ingestion → transformation → model training → evaluation
- Batch processing (all data processed at once in Colab)
- Key libraries: pandas, scikit-learn, XGBoost, NLTK or spaCy (for tokenization/lemmatization)
- Runtime: Google Colab (Python 3 environment)

##### Detailed elements
- Dataset directory and files under Data Sources
- Output artifacts: Notebook (.ipynb), Report (.pdf), Presentation (.pptx)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Google Colab Environment"
        direction TB
        Data1["emojis.txt"]:::data_blue
        Data2["text_emotions.csv"]:::data_blue
        Preprocessing["Preprocessing\n- Punctuation removal\n- Emoji conversion\n- Tokenization\n- Stopword removal\n- Lemmatization"]:::preprocess_green
        FeatureExtraction["Feature Extraction\nTF–IDF vectorizer"]:::preprocess_green
        SVM["Support Vector Machine"]:::model_orange
        LR["Logistic Regression"]:::model_orange
        RF["Random Forest"]:::model_orange
        XGB["XGBoost"]:::model_orange
        MNB["Multinomial Naive Bayes"]:::model_orange
        DT["Decision Tree"]:::model_orange
        Evaluation["Evaluation & Comparison\n- Accuracy calculation\n- Tabular/graphical comparison"]:::eval_purple
        Data1 -->|"raw data"| Preprocessing
        Data2 -->|"raw data"| Preprocessing
        Preprocessing -->|"clean text"| FeatureExtraction
        FeatureExtraction -->|"feature vectors"| SVM
        FeatureExtraction -->|"feature vectors"| LR
        FeatureExtraction -->|"feature vectors"| RF
        FeatureExtraction -->|"feature vectors"| XGB
        FeatureExtraction -->|"feature vectors"| MNB
        FeatureExtraction -->|"feature vectors"| DT
        SVM -->|"predictions"| Evaluation
        LR -->|"predictions"| Evaluation
        RF -->|"predictions"| Evaluation
        XGB -->|"predictions"| Evaluation
        MNB -->|"predictions"| Evaluation
        DT -->|"predictions"| Evaluation
    end

    Evaluation -->|"results"| Notebook
    Evaluation -->|"results"| Report
    Evaluation -->|"results"| Presentation

    Notebook["Jupyter Notebook (.ipynb)"]:::output_purple
    Report["Report (.pdf)"]:::output_purple
    Presentation["Presentation (.pptx)"]:::output_purple
    README["README.md"]:::data_blue

    click Data1 "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Dataset/emojis.txt"
    click Data2 "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Dataset/text_emotions.csv"
    click Preprocessing "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click FeatureExtraction "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click SVM "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click LR "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click RF "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click XGB "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click MNB "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click DT "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click Evaluation "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click Notebook "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text.ipynb"
    click Report "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion_Detection_from_Text_Report.pdf"
    click Presentation "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/Emotion Detection from Text_Presentation.pptx"
    click README "https://github.com/rejonehridoy/emotion_detection_from_text_using_machine_learning/blob/main/README.md"

    classDef data_blue fill:#cce5ff,stroke:#0366d6,color:#0366d6
    classDef preprocess_green fill:#d4edda,stroke:#28a745,color:#155724
    classDef model_orange fill:#ffe5b4,stroke:#e69500,color:#8a4b08
    classDef eval_purple fill:#e2d6f0,stroke:#6f42c1,color:#3f1d6b
    classDef output_purple fill:#e2d6f0,stroke:#6f42c1,color:#3f1d6b
```
