A document intelligence pipeline that preserves document structure across parsing, semantic chunking, entity extraction, and graph construction.
The project addresses a common limitation of text-only chunking: relationships between text, tables, figures, captions, and document sections can be lost when a document is split into isolated chunks.
The pipeline keeps document provenance across processing stages and uses it to build both an entity graph and a document linking graph.
PDF / DOCX / PPTX
↓
Structured Parsing
↓
Semantic Chunking
↓
Named Entity Recognition
↓
Entity Resolution
↓
┌──────────────────────┬────────────────────────┐
↓ ↓
Entity Graph Document Linking Graph
- Structure-aware parsing of PDF, DOCX, and PPTX documents
- Semantic chunking with document provenance
- Named entity extraction with SpaCy and optional GLiNER
- Entity normalization and duplicate resolution
- Entity co-occurrence graph construction
- Document linking graph connecting entities, chunks, tables, figures, and captions
- Interactive HTML visualization
- GraphML and JSON exports
- Automated smoke tests and output validation
The pipeline generates two main graph representations:
A baseline graph where entities are connected based on co-occurrence within document chunks.
Entity ↔ Entity
A provenance-aware graph preserving relationships between extracted knowledge and document structure.
Entity → MENTIONED_IN → Chunk
Entity → DISCUSSED_NEAR → Figure / Table / Caption
Chunk → RELATED_TO → Figure / Table / Caption
Figure → HAS_CAPTION → Caption
git clone https://github.com/ILYUTKICK/doc-entity-graph.git
cd doc-entity-graph
bash scripts/setup_env.shActivate the created environment and generate a reproducible demo document:
python scripts/create_demo_input.pyRun the full pipeline:
bash scripts/run_pipeline.sh data/raw_demo pipeline 512 1 12Run validation:
python -B -m unittest discover -s tests
bash scripts/check_outputs.shDocument processing: MinerU
NLP: SpaCy, optional GLiNER
Graphs: NetworkX
Visualization: D3.js
Language: Python 3.11
doc-entity-graph/
├── configs/
├── data/
├── docs/
├── outputs/
├── scripts/
├── src/
├── tests/
├── requirements.txt
└── README.md
Detailed documentation is available in docs/:
- The entity graph currently uses co-occurrence as a baseline relationship signal rather than full semantic relation extraction.
- NER quality depends on the selected model and document domain.
- Document parsing quality depends on the source file structure and MinerU output.
- Optional GLiNER enrichment may require additional model downloads and network access.

