AI for language analysis for three languages: Somali, English, Kiswahili
# English, Kiswahili & Somali AI Sentiment Analysis Tool
A professional portfolio project that classifies user text in English, Kiswahili, and Somali as **positive**, **negative**, or **neutral** sentiment.
## Overview
This project demonstrates a complete NLP workflow with a reusable model and REST API:
- dataset preparation
- text preprocessing
- TF-IDF vectorization
- logistic regression training
- model persistence
- API inference with FastAPI
- automated tests for reliability
## Problem Statement
Organizations need a reliable way to classify short customer or service text in English, Kiswahili, and Somali. This tool provides a lightweight sentiment classifier that can be run locally and explained in an interview.
## Objectives
- Build a genuinely working sentiment analysis application
- Support English, Kiswahili, and Somali text
- Use explainable, reproducible ML components
- Provide a REST API for predictions
- Include tests and documentation for GitHub readiness
## Technologies Used
- Python 3
- pandas
- NumPy
- scikit-learn
- FastAPI
- Uvicorn
- pytest
- HTML, CSS, JavaScript
## Project Architecture
```
sentiment-analysis/
│
├── data/
│ └── sentiment_dataset.csv
├── models/
│ ├── sentiment_model.pkl
│ └── tfidf_vectorizer.pkl
├── src/
│ ├── preprocessing.py
│ ├── train.py
│ ├── predict.py
│ └── api.py
├── tests/
│ ├── test_api.py
│ ├── test_predict.py
│ └── test_preprocessing.py
├── app.py
├── requirements.txt
├── README.md
└── .gitignore
```
## Dataset Description
The dataset is a small, custom training dataset stored in `data/sentiment_dataset.csv`. It contains:
- `text`: English, Kiswahili, or Somali sentences
- `language`: language code (`en`, `sw`, or `so`)
- `sentiment`: sentiment label (`positive`, `negative`, `neutral`)
The dataset currently includes 30 English examples, 30 Kiswahili examples, and 9 Somali examples. It is intentionally compact and created for demonstrative portfolio purposes. It is not a claim of lar …