Tunisian Economy Knowledge Graph
# Tunisian Economy Knowledge Graph
A knowledge graph system that extracts and visualizes relationships between companies, people, and organizations in the Tunisian economy using natural language processing and graph databases.
## Overview
This project automatically processes documents (PDFs, web articles) about Tunisian businesses and creates a queryable knowledge graph showing ownership structures, board memberships, and business relationships. It handles multilingual content (French, Arabic, English) and provides an interactive visualization interface.
## Features
- **📄 Document Processing**: Upload PDFs or scrape Tunisian news sources (TAP, African Manager, IlBoursa)
- **🔍 Entity Extraction**: Hybrid NLP pipeline using spaCy and local LLM (Ollama) to identify companies, people, and organizations
- **🧠 Multilingual Support**: Handles Arabic, French, and English business names with fuzzy matching and entity resolution
- **📊 Knowledge Graph**: Neo4j graph database with full traceability to source documents
- **🔎 Natural Language Queries**: Ask questions like "Who owns Poulina Group?" and get graph-based answers
- **🌐 Interactive Visualization**: React-based graph explorer using Cytoscape.js
## Architecture
### Tech Stack
- **Backend**: Python 3.11+, FastAPI, spaCy, PyMuPDF
- **Graph Database**: Neo4j 5.x
- **Frontend**: React 18, Vite, Cytoscape.js
- **NLP**: spaCy (French/English models), Ollama (local LLM for relationship extraction)
### 5-Layer Pipeline
```
┌─────────────────┐
│ 1. Ingestion │ PDF upload, web scraping
└────────┬────────┘
│
┌────────▼────────┐
│ 2. Processing │ Text extraction, OCR, chunking
└────────┬────────┘
│
┌────────▼────────┐
│ 3. Extraction │ NER (entities) + LLM (relationships)
└────────┬────────┘
│
┌────────▼────────┐
│ 4. Resolution │ Entity deduplication, multilingual matching
└────────┬────────┘
│
┌────────▼────────┐
│ 5. Storage │ Neo4j graph with traceability
└─────────────────┘
```
## Quick Start
### …