Skip to content

garibli/NLPModels

Repository files navigation

📊 NLP-Based Text Data Analysis

This repository contains the codebase for my senior design project titled “Analysis of Text Data via NLP Tools”, which focuses on the application of Natural Language Processing (NLP) models to understand and classify text data in three real-world tasks:

  1. Sentiment Analysis
  2. Offensive Language Detection
  3. Disaster Help Classification

Each task was approached using state-of-the-art transformer-based models such as BERT and RoBERTa, along with rule-based techniques for enhanced interpretability and performance.


🔍 Project Overview

The project is divided into three main modules:

1. Sentiment Analysis with BERT

  • Model: Pretrained bert-base-uncased
  • Task: Classify texts as positive, negative, or neutral
  • Data: Custom-labeled social media posts (can be replaced with any sentiment-labeled dataset)
  • Highlights:
    • Fine-tuned BERT with attention masking and padding
    • Clean data preprocessing and tokenization
    • Evaluation using accuracy, precision, recall, F1-score

2. Offensive Language Detection with RoBERTa

  • Model: Pretrained roberta-base
  • Task: Detect offensive, abusive, or inappropriate language
  • Data: Public offensive language datasets (like OLID or custom Twitter data)
  • Highlights:
    • RoBERTa fine-tuned on binary classification
    • Applied model interpretability with LIME and SHAP
    • Confusion matrix and detailed error analysis included

3. Disaster Help Classification (BERT + Regex)

  • Model: bert-base-uncased combined with rule-based regex filtering
  • Task: Classify whether a tweet is a request for help during disasters
  • Data: Real-time disaster tweets (e.g., CrisisNLP, CrowdFlower)
  • Highlights:
    • Hybrid model combining deep learning and traditional NLP
    • Regex to catch patterns like "need food", "send help", etc.
    • Fused model output for better precision in emergency contexts

🧠 Tools & Libraries

  • Python 3.9+
  • PyTorch
  • HuggingFace Transformers
  • Scikit-Learn
  • Pandas, NumPy, Matplotlib, Seaborn
  • Regex
  • LIME / SHAP for model explainability
  • Jupyter Notebooks

✅ Results:

Task Model Accuracy F1-Score
Sentiment Analysis BERT ~87% ~0.86
Offensive Detection RoBERTa ~91% ~0.90
Disaster Help Detection BERT + Regex ~89% ~0.88

💬 Future Work

-Expand multi-language support (e.g., Turkish, Azerbaijani) -Integrate into a web dashboard for real-time monitoring -Enhance explainability tools for broader model transparency

🙋‍♂️ Author

Fuad Garibli B.Sc. in Computer Engineering, Sakarya University Passionate about NLP, Data Science, and Social Impact 📫 www.linkedin.com/in/fuad-garibli-936354272

About

3 Deep Leraning models were developped for this project: Offensive Detection (via RoBERTa), Sentimental Analysis (via BERT) and Disaster Help (via BERT-base).

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors