A Real-Time Social Media Analytics Pipeline & Dashboard
Paris 8 University - 2022 Original
Authors: Imen L'Hocine Mecerrem, Victor Matalonga, MickaΓ«l D. Pernet
2026 Refactored for Translation.
(Hybrid_NLP_Pipeline_for_Hate_Speech_Detection_From_Unsupervised_Anomaly_Discovery_to_Transformer-based_Inference.pdf)
This research presents a modular infrastructure for detecting hate speech in French social media streams. By shifting from traditional keyword filtering to an Unsupervised Anomaly Discovery approach using Local Outlier Factor (LOF), the system identifies toxic content as a statistical deviation in semantic density. The pipeline integrates high-frequency data ingestion, a hybrid NLP processing engine, and a visual analytics dashboard to provide a comprehensive framework for real-time linguistic monitoring.
This repository serves as the Strategic & Technical Hub for the research: "Hybrid NLP Pipeline for Hate Speech Detection: From Unsupervised Anomaly Discovery to Transformer-based Inference." It functions as a near real-time analytical engine, providing the framework to transform raw social media streams into structured scientific intelligence focused on French linguistic toxicity.
- Executive Summary (PDF): The theoretical and methodological framework.
- Analysis Engine: The detection engine.
- Monitoring: The Dash/Plotly interface for result exploitation and monitoring.
- Language: Python 3.9+
π‘ 1. Data Ingestion (UScrap Engine)
- Core: Multi-threaded Python architecture for high-frequency harvesting.
- API: Tweepy (v2) with autonomous rate-limit orchestration.
- UI: PySide6 (Qt).
- Persistence: Raw data injection via Psycopg2.
π§ 2. NLP & Machine Learning Pipeline
- Linguistic Engines: SpaCy (fr_core_news_sm) and NLTK (SnowballStemmer).
- Vectorization: Gensim (Word2Vec) for semantic mapping.
- Anomaly Detection: Scikit-Learn implementing Local Outlier Factor (LOF, K-Means, isolation forest) to detect hate speech as a statistical outlier.
- Processing: Specialized Regex filters for French Unicode and PII (Personal Identifiable Information) sanitization.
π 3. Visual Analytics
- Framework: Plotly Dash & Flask.
- Data Handling: Pandas & NumPy for time-series aggregation.
- ORM: SQLAlchemy for structured database queries.
The framework operates as a high-performance data pipeline, moving from raw ingestion to unsupervised machine learning and live visualization.
-
Ingestion Engine (UScrap): A multi-threaded harvester optimized for the Twitter API (v2). It utilizes independent worker threads to maintain high-frequency collection of French social media streams while preserving UI responsiveness via PySide6.
-
Processing & Storage Layer: A relational PostgreSQL core managed by SQLAlchemy. This layer performs automated data cleaning, PII sanitization (GDPR compliant), and indexing via Pandas to prepare datasets for both regex-based filters and ML inference.
-
Analytics & Visualization Layer: A dynamic Dash (Plotly/Flask) application providing an interactive window into the engine's outputs:
- Near Real-Time Monitoring: Live tracking of linguistic trends and volume.
- Anomaly-Based Categorization: Distinguishing hate speech types (Racism, Homophobia, etc.) using Local Outlier Factor (LOF) and optimized French regex patterns.
- Lexical Density: Multi-dimensional frequency analysis and dynamic WordCloud generation.
The research is supported by three interconnected modules:
- UScrap2Gather-Multithread-Engine: The ingestion layer. A high-frequency scraper capable of harvesting millions of tweets with relational integrity.
- NLP-Exploratory-Pipeline-HateSpeech: The Analytical Core. This module performs the primary linguistic audit, implementing Local Outlier Factor (LOF) and K-Means to identify hate speech as a statistical anomaly within French discourse.
- Hate-Speech-Detection-NLP-Pipeline (This Repository): This module integrates the full research process. It hosts the Executive Summary PDF and provides the project's Visual Analytics files (Dash/Plotly) and analysis engine.