# saramansuri12/hinglish-sentiment architecture

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

- Interactive diagram: https://gitdiagram.com/saramansuri12/hinglish-sentiment
- Repository: https://github.com/saramansuri12/hinglish-sentiment

## Overview

This repository builds three-class sentiment classifiers from labeled text. The workflow converts CoNLL data to CSV, cleans the text, then trains and evaluates either TF-IDF-based classifiers or a fine-tuned XLM-R transformer. Classical scripts save model/vectorizer artifacts; the transformer script saves its model and tokenizer under `models/xlm_roberta` (that output directory is not in the supplied tree). The README is empty, so capabilities and links here are based on the tree and sampled source; no inference or serving workflow is evident.

Main entry points: [`src/train_word_char.py`](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_word_char.py) (Word-char model), [`src/train_ml.py`](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_ml.py) (Logistic regression), [`src/train_svm.py`](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_svm.py) (Linear SVM), [`data/processed/train_clean.csv`](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/train_clean.csv) (Clean training CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset preparation"]
  node_raw_train["Raw training data"]
  node_raw_dev["Raw development data"]
  node_convert["CoNLL conversion<br/>[convert_dataset.py]"]
  node_train_csv["Training CSV<br/>[train.csv]"]
  node_dev_csv["Development CSV<br/>[dev.csv]"]
  node_preprocess["Text cleaning<br/>[preprocess.py]"]
  node_clean_train["Clean training CSV<br/>[train_clean.csv]"]
  node_clean_dev["Clean development CSV<br/>[dev_clean.csv]"]
end

subgraph group_classical["Classical models"]
  node_train_ml["Logistic regression<br/>[train_ml.py]"]
  node_train_svm["Linear SVM<br/>[train_svm.py]"]
  node_train_word_char["Word-char model<br/>[train_word_char.py]"]
  node_evaluation["Dev evaluation<br/>[train_ml.py]"]
end

subgraph group_transformer["Transformer model"]
  node_transformer_training["XLM-R fine-tuning"]
end

subgraph group_artifacts["Saved artifacts"]
  node_logistic_model["Logistic model"]
  node_tfidf_model["TF-IDF vectorizer"]
  node_svm_model["SVM model<br/>[svm_model.pkl]"]
  node_svm_vectorizer["SVM vectorizer"]
  node_word_char_model["Word-char logistic"]
  node_word_vectorizer["Word vectorizer"]
  node_char_vectorizer["Character vectorizer"]
end

node_operator(("Workflow operator"))
node_model_hub{{"Hugging Face model hub"}}

node_operator -->|"runs conversion"| node_convert
node_raw_train -->|"reads"| node_convert
node_raw_dev -->|"reads"| node_convert
node_convert -->|"writes"| node_train_csv
node_convert -->|"writes"| node_dev_csv
node_operator -->|"runs cleaning"| node_preprocess
node_train_csv -->|"reads"| node_preprocess
node_dev_csv -->|"reads"| node_preprocess
node_preprocess -->|"writes"| node_clean_train
node_preprocess -->|"writes"| node_clean_dev
node_operator -->|"runs training"| node_train_ml
node_operator -->|"runs training"| node_train_svm
node_operator -->|"runs training"| node_train_word_char
node_clean_train -->|"reads"| node_train_ml
node_clean_dev -->|"reads"| node_train_ml
node_clean_train -->|"reads"| node_train_svm
node_clean_dev -->|"reads"| node_train_svm
node_clean_train -->|"reads"| node_train_word_char
node_clean_dev -->|"reads"| node_train_word_char
node_train_ml -->|"evaluates"| node_evaluation
node_train_svm -->|"evaluates"| node_evaluation
node_train_word_char -->|"evaluates"| node_evaluation
node_train_ml -->|"saves"| node_logistic_model
node_train_ml -->|"saves"| node_tfidf_model
node_train_svm -->|"saves"| node_svm_model
node_train_svm -->|"saves"| node_svm_vectorizer
node_train_word_char -->|"saves"| node_word_char_model
node_train_word_char -->|"saves"| node_word_vectorizer
node_train_word_char -->|"saves"| node_char_vectorizer
node_operator -->|"runs fine-tuning"| node_transformer_training
node_clean_train -->|"reads"| node_transformer_training
node_clean_dev -->|"reads"| node_transformer_training
node_transformer_training -.->|"loads pretrained model"| node_model_hub
node_transformer_training -->|"evaluates"| node_evaluation

click node_raw_train "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/raw/train_14k_split_conll.txt"
click node_raw_dev "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/raw/dev_3k_split_conll.txt"
click node_convert "https://github.com/saramansuri12/hinglish-sentiment/blob/main/convert_dataset.py"
click node_train_csv "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/train.csv"
click node_dev_csv "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/dev.csv"
click node_preprocess "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/preprocess.py"
click node_clean_train "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/train_clean.csv"
click node_clean_dev "https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/dev_clean.csv"
click node_train_ml "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_ml.py"
click node_train_svm "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_svm.py"
click node_train_word_char "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_word_char.py"
click node_evaluation "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_ml.py"
click node_transformer_training "https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_transformer.py"
click node_logistic_model "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/logistic_regression.pkl"
click node_tfidf_model "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/tfidf_vectorizer.pkl"
click node_svm_model "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/svm_model.pkl"
click node_svm_vectorizer "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/svm_tfidf_vectorizer.pkl"
click node_word_char_model "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/word_char_logistic.pkl"
click node_word_vectorizer "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/word_tfidf_vectorizer.pkl"
click node_char_vectorizer "https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/char_tfidf_vectorizer.pkl"

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_raw_train,node_raw_dev,node_convert,node_train_csv,node_dev_csv,node_preprocess,node_clean_train,node_clean_dev toneBlue
class node_train_ml,node_train_svm,node_train_word_char,node_evaluation toneAmber
class node_transformer_training toneMint
class node_logistic_model,node_tfidf_model,node_svm_model,node_svm_vectorizer,node_word_char_model,node_word_vectorizer,node_char_vectorizer toneRose
class node_operator,node_model_hub toneIndigo
```

## Components

### Dataset preparation

- [Raw training data](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/raw/train_14k_split_conll.txt): `data/raw/train_14k_split_conll.txt`
- [Raw development data](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/raw/dev_3k_split_conll.txt): `data/raw/dev_3k_split_conll.txt`
- [CoNLL conversion](https://github.com/saramansuri12/hinglish-sentiment/blob/main/convert_dataset.py): `convert_dataset.py`
- [Training CSV](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/train.csv): `data/processed/train.csv`
- [Development CSV](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/dev.csv): `data/processed/dev.csv`
- [Text cleaning](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/preprocess.py): `src/preprocess.py`
- [Clean training CSV](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/train_clean.csv): `data/processed/train_clean.csv`
- [Clean development CSV](https://github.com/saramansuri12/hinglish-sentiment/blob/main/data/processed/dev_clean.csv): `data/processed/dev_clean.csv`

### Classical models

- [Logistic regression](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_ml.py): `src/train_ml.py`
- [Linear SVM](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_svm.py): `src/train_svm.py`
- [Word-char model](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_word_char.py): `src/train_word_char.py`
- [Dev evaluation](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_ml.py): `src/train_ml.py`

### Transformer model

- [XLM-R fine-tuning](https://github.com/saramansuri12/hinglish-sentiment/blob/main/src/train_transformer.py): `src/train_transformer.py`

### Saved artifacts

- [Logistic model](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/logistic_regression.pkl): `models/logistic_regression.pkl`
- [TF-IDF vectorizer](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/tfidf_vectorizer.pkl): `models/tfidf_vectorizer.pkl`
- [SVM model](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/svm_model.pkl): `models/svm_model.pkl`
- [SVM vectorizer](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/svm_tfidf_vectorizer.pkl): `models/svm_tfidf_vectorizer.pkl`
- [Word-char logistic](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/word_char_logistic.pkl): `models/word_char_logistic.pkl`
- [Word vectorizer](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/word_tfidf_vectorizer.pkl): `models/word_tfidf_vectorizer.pkl`
- [Character vectorizer](https://github.com/saramansuri12/hinglish-sentiment/blob/main/models/char_tfidf_vectorizer.pkl): `models/char_tfidf_vectorizer.pkl`

### Other components

- **Workflow operator**
- **Hugging Face model hub**

## Connections

- Workflow operator → CoNLL conversion: runs conversion
- Raw training data → CoNLL conversion: reads
- Raw development data → CoNLL conversion: reads
- CoNLL conversion → Training CSV: writes
- CoNLL conversion → Development CSV: writes
- Workflow operator → Text cleaning: runs cleaning
- Training CSV → Text cleaning: reads
- Development CSV → Text cleaning: reads
- Text cleaning → Clean training CSV: writes
- Text cleaning → Clean development CSV: writes
- Workflow operator → Logistic regression: runs training
- Workflow operator → Linear SVM: runs training
- Workflow operator → Word-char model: runs training
- Clean training CSV → Logistic regression: reads
- Clean development CSV → Logistic regression: reads
- Clean training CSV → Linear SVM: reads
- Clean development CSV → Linear SVM: reads
- Clean training CSV → Word-char model: reads
- Clean development CSV → Word-char model: reads
- Logistic regression → Dev evaluation: evaluates
- Linear SVM → Dev evaluation: evaluates
- Word-char model → Dev evaluation: evaluates
- Logistic regression → Logistic model: saves
- Logistic regression → TF-IDF vectorizer: saves
- Linear SVM → SVM model: saves
- Linear SVM → SVM vectorizer: saves
- Word-char model → Word-char logistic: saves
- Word-char model → Word vectorizer: saves
- Word-char model → Character vectorizer: saves
- Workflow operator → XLM-R fine-tuning: runs fine-tuning
- Clean training CSV → XLM-R fine-tuning: reads
- Clean development CSV → XLM-R fine-tuning: reads
- XLM-R fine-tuning → Hugging Face model hub: loads pretrained model
- XLM-R fine-tuning → Dev evaluation: evaluates
