Skip to main content

Multimodal sentiment analysis for e-commerce: text + emoji + sticker fusion with ML classifiers.

Project description

Echo Feeling

PyPI Python License

Echo Feeling is a multimodal sentiment analysis library for e-commerce platforms. It goes beyond text-only approaches by integrating emojis and stickers as expressive modalities, enabling more accurate and nuanced detection of customer sentiment.


Features

  • Multimodal Fusion – combines text (BoW + TF-IDF + optional BERT), emoji, and sticker signals into a unified feature vector
  • Multiple ML Classifiers – SVM, Random Forest, and Feedforward Neural Network with k-fold cross-validation
  • Admin Panel Ready – REST API (Flask) + Node.js wrapper for seamless e-commerce integration
  • Suspicious Review Detection – automatically flags potentially fraudulent or abusive feedback
  • Product-level Dashboard – aggregated sentiment counts, percentages, and emoji trends per product

Architecture

six-phase pipeline
──────────────────
Phase 1  E-Commerce Website (data source + admin panel)
Phase 2  Data Collection & Preprocessing
           └─ text normalisation → emoji standardisation → sticker labelling
Phase 3  Feature Extraction
           └─ BoW / TF-IDF / BERT  |  emoji sentiment scores  |  sticker encoded weights
Phase 4  Multimodal Fusion
           └─ concatenate + scale → unified feature vector
Phase 5  Model Training & Evaluation
           └─ SVM (F1 0.85) · Random Forest (F1 0.83) · Neural Network (F1 0.89*)
Phase 6  Deployment as Node.js module (Flask API + JS wrapper)

* Results reported in the SAMANWAYA'26 paper.


Project Structure

final/
├── echo_feeling/               # Installable Python package
│   ├── __init__.py
│   ├── api.py                  # Public API: analyze(), analyze_batch(), product_dashboard()
│   └── engine.py               # SentimentEngine (loads models, runs inference)
│
├── training_phase/             # Training pipeline
│   ├── preprocessor.py         # Text normalisation, emoji standardisation, sticker labelling
│   ├── feature_extractor.py    # BoW, TF-IDF, BERT, emoji & sticker extractors, fusion
│   └── train.py                # CLI training script
│
├── deployment_phase/           # Deployment
│   ├── server.py               # Flask REST API server
│   └── sentiment_module.js     # Node.js wrapper module
│
├── models/                     # Saved model artefacts (generated by train.py)
├── data/                       # Place your datasets here
│   ├── reviews.csv
│   └── stickers/
│       ├── positive/   *.png
│       ├── negative/   *.png
│       └── neutral/    *.png
│
├── requirements.txt
└── setup.py

Installation

pip install echo-feeling
# or from source:
pip install -e ".[server]"

Quick Start

Python

from echo_feeling.api import analyze, product_dashboard

# Single review (text + emoji + sticker)
result = analyze("Absolutely love this! 😍👍", sticker="positive")
print(result)
# {'label': 'positive', 'confidence': 0.94, 'scores': {...}, 'emoji_score': 0.875}

# Product-level dashboard (for admin panel)
reviews = [
    "Great quality, fast delivery! 😊",
    "Terrible product, waste of money 😡",
    "It's okay, nothing special",
]
summary = product_dashboard(reviews)
print(summary["counts"])        # {'positive': 1, 'negative': 1, 'neutral': 1}
print(summary["percentages"])   # {'positive': 33.3, 'negative': 33.3, 'neutral': 33.3}

Training

# 1. Prepare your CSV with columns: review, label, sticker
# 2. Organise sticker PNG images into data/stickers/positive|negative|neutral/

python training_phase/train.py \
  --data_path data/reviews.csv \
  --sticker_root data/stickers \
  --output_dir models

CSV format:

review,label,sticker
"Great product! 😊",positive,positive
"Worst purchase ever 😡",negative,negative
"It's okay",neutral,neutral

REST API Server

python deployment_phase/server.py --port 5000

# Analyse a review
curl -X POST http://localhost:5000/analyze \
     -H "Content-Type: application/json" \
     -d '{"review": "Amazing! 😍", "sticker": "positive"}'

# Get product dashboard
curl http://localhost:5000/product/PROD123

Node.js Integration

const sentiment = require('./deployment_phase/sentiment_module');

// Analyse a review
const result = await sentiment.analyze("Excellent product! 😊", "positive");
console.log(result.label); // "positive"

// Add review to a product
await sentiment.addReview("PROD123", "Amazing quality!", "positive");

// Get admin dashboard for a product
const summary = await sentiment.getProductSummary("PROD123");
console.log(summary.counts);

// Delete a suspicious review (admin moderation)
await sentiment.deleteReview(reviewId);

// Use as Express middleware
const express = require('express');
const app = express();
app.use(sentiment.sentimentMiddleware());
app.post('/review', async (req, res) => {
  const result = await req.sentiment.analyze(req.body.text);
  res.json(result);
});

API Reference

analyze(text, sticker="neutral", model_dir=None) → dict

Field Type Description
label str positive / negative / neutral / suspicious
confidence float Model confidence [0, 1]
scores dict Per-class probability
emoji_score float Aggregate emoji sentiment score [-1, 1]

analyze_batch(texts, stickers=None) → list[dict]

product_dashboard(reviews, stickers=None) → dict

Field Type Description
total_reviews int Total review count
counts dict Count per sentiment label
percentages dict Percentage per sentiment label
avg_confidence float Mean model confidence
avg_emoji_score float Mean emoji sentiment
flagged_suspicious list[int] Indices of suspicious reviews

Model Performance

Model F1-Score Precision Recall
Neural Network 0.89 0.90 0.88
SVM 0.85 0.86 0.84
Random Forest 0.83 0.84 0.82

Evaluated with 5-fold stratified cross-validation on multimodal fused features.


License

MIT License – see LICENSE for details.


Authors

Created by Swathi Lekshmi SS, Romin Varghese, R Arun, Ivin Issac
College of Engineering Karunagappally
Guided by Hridhya J (Asst. Professor, CSE)

Published at SAMANWAYA'26 – AI-Powered Review Mining for Subjective Text Understanding

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echo_feeling-2.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echo_feeling-2.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file echo_feeling-2.1.0.tar.gz.

File metadata

  • Download URL: echo_feeling-2.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for echo_feeling-2.1.0.tar.gz
Algorithm Hash digest
SHA256 6f1ef38221dbe306d46de92672a17320bd7164cb8f35e0bb126f96a54995f2ad
MD5 1fb21765d1a4834e8e8d829d1bd99e69
BLAKE2b-256 bee317e2e1d1cb59e2f4ed395217aece9ea84448dc7df7eaa925f6e635237038

See more details on using hashes here.

File details

Details for the file echo_feeling-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: echo_feeling-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for echo_feeling-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c57611d871afbd394f6133e774170091427f1709b7e883ea5e7526e1bcad43d0
MD5 0047e185c6857a8042345bb3702ca938
BLAKE2b-256 8a513d0af109531816eabef4beaed9a1c0f25d7332ea25b6384caec202524772

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page