--- title: ESG Ontology-Based Sentiment Mapping emoji: 🌱 colorFrom: green colorTo: blue sdk: gradio app_file: app.py pinned: false --- # Advanced ESG Analysis & Interpretability Dashboard This project provides a powerful, interactive dashboard for in-depth analysis of Environmental, Social, and Governance (ESG) reports. It goes beyond simple keyword matching by leveraging a custom ontology, advanced NLP models, and a suite of analytical tools to uncover nuanced insights, detect sentiment drift, and identify potential greenwashing. The application is built with Gradio and integrates several advanced features, from section-aware context modeling to knowledge graph generation and bias analysis. ## Key Features The dashboard integrates a multi-stage pipeline to deliver deep, explainable insights: * **Ontology-Powered Aspect Mapping**: Maps text from ESG reports to a custom, hierarchical ESG ontology (`esg_ontology.owl`), ensuring that analysis is grounded in a structured, domain-specific framework. * **Section-Aware Context Modeling**: Intelligently distinguishes between different sections of a report (e.g., "Commitments" vs. "Results") and applies contextual weights to mitigate optimism bias in forward-looking statements. * **Cross-Document Consistency Analysis**: Compares two documents (e.g., reports from consecutive years) to automatically detect *sentiment drift* for specific ESG aspects, flagging potential inconsistencies or greenwashing. * **Weakly Supervised Aspect Expansion**: Uses `KeyBERT` to discover emerging ESG topics and keywords from the input text that are not yet in the ontology, suggesting them for future inclusion. * **Knowledge Graph Generation**: Exports the analysis results into a machine-readable RDF Turtle file (`esg_knowledge_graph.ttl`), representing documents, aspects, and sentiments as a semantic graph. * **Fine-Tuning Ready**: The architecture is designed to seamlessly integrate a fine-tuned sentence transformer model for improved domain adaptation and mapping accuracy. A training script template (`train_finetune.py`) is provided. * **Interpretability Dashboard**: * **Sentiment Distribution**: Visualizes the breakdown of positive, negative, and neutral sentiments across documents. * **Bias & Confidence Analysis**: A scatter plot that correlates "Optimism Bias" with "Mapping Confidence" to help users critically evaluate the sentiment associated with each aspect. * **Ontology Viewer**: Displays the structure of the ESG ontology directly in the dashboard. Hybrid stage (7 + 8 + 10) * The ontology backbone (Stage 7) structures the ESG knowledge. * The weakly supervised extraction (Stage 8) expands it dynamically. * The dashboard layer (Stage 10) communicates interpretability metrics. * Once you fine-tune embeddings on ESG corpora (Stage 9), your system will reach full maturity — improving confidence and semantic clustering precision.