Skip to content

anaakhaa/project-8

Repository files navigation

project-8

CONTEXTIQ : AN ADVANCED FRAMEWORK FOR CONTEXTUAL ANALYSIS AND RISK DETECTION

Abstract

In the digital era, interpreting sentiment and emotional tone in text is challenging, especially with irony and sarcasm obscuring intent. Traditional models often misclassify text due to surface-level analysis, leading to inaccuracies. To address this, we present a Context-Aware System that integrates emotion detection, irony recognition, hate speech detection, named entity recognition (NER), and part-of-speech (POS) tagging for deeper, context-rich sentiment analysis.

A key feature is the Contextual Harm Score (CHS), which evaluates the potential harmful impact of text by analyzing sentiment, irony, and context, making it ideal for social media monitoring, content moderation, and misinformation detection. By considering contextual depth, named entities, and grammatical structure, the system provides real-world insights beyond surface meaning and is adaptable for various text types, including social media, news, and conversational language.

The system leverages finetuned transformer models like BERT and RoBERTa from Hugging Face, alongside Stanza for POS tagging, to identify nuanced patterns of bias and discrimination. A Streamlit interface offers real-time analysis, modular breakdowns, dynamic visualizations, and Excel export options, ensuring usability for developers, researchers, and policymakers. A demo dashboard structure further illustrates potential integrations across diverse applications, enhancing accessibility and scalability.

🚀 Features

  • Multilingual Support with auto-translation
  • Emotion Detection (e.g., anger, fear, joy, sadness)
  • Irony & Sarcasm Recognition
  • Named Entity Recognition (NER) with contextual tagging
  • POS Tagging using Stanza
  • Contextual Harm Score (CHS) computation
  • HateXplain-based Harassment Detection
  • Streamlit Web Interface with real-time and batch analysis
  • Excel Export and Data Visualization
  • Demo Dashboard for future real-time integrations

🧱 Architecture

User Input ➝ Translation ➝ NLP Analysis ⤷ Emotion Detection ⤷ Irony Detection ⤷ NER & POS Tagging ⤷ Harassment Detection ➝ CHS Computation ➝ Visualization & Export

💻 Technology Stack

Layer Technology
Programming Language Python 3.x
Frontend UI Streamlit
NLP Libraries Transformers, Stanza, Langdetect, Deep-Translator
Visualization Plotly Express, Pandas
Model Sources Hugging Face Transformers, HateXplain
Storage/Export Excel (OpenPyXL)

📦 Folder Structure

 ```text 📁 contextiq/ ├── context_aware.py # Main pipeline integrating all modules  ├── Dashboard_demo.py # Static UI dashboard for future real-time integrations  ├── emotion_detection.py # Emotion detection module  ├── harassment_detection.py # HateXplain-based harassment detection module  ├── irony_detection.py # Irony detection module 
 ├── NER_multi.py # Named Entity Recognition (multilingual) ├── POS_multi.py # Part-of-Speech tagging (multilingual)  ├── sentiment_multilingual.py # Multilingual sentiment analysis  ├── streamlit_app.py # Main Streamlit application  ├── sample.py # Optional: sample test runner or CLI testing  ├── setup.py # Setup script (optional for pip install)  ├── requirements.txt # Python dependencies  ├── NOTE # Any notes or config files └── README.md # Project documentation ``` 

📊 Use Cases

  • Social Media Content Monitoring
  • Crisis Communication & Risk Scoring
  • Mental Health Sentiment Analysis
  • Harassment & Toxicity Detection
  • Educational Feedback Systems
  • Customer Service Chatbots
  • Brand Sentiment Dashboards