Metadata-Version: 2.4
Name: narrativegraphs
Version: 0.4.0
Summary: A package for creating and analyzing narrative graphs from text corpora
Author-email: Kasper Fyhn <kasperfyhnjacobsen@gmail.com>
License-Expression: MIT
Project-URL: Documentation, https://kasperfyhn.github.io/narrativegraphs
Project-URL: Repository, https://github.com/KasperFyhn/narrativegraphs
Project-URL: Bug Tracker, https://github.com/your-username/narrativegraphs/issues
Keywords: nlp,narrative-analysis,network-analysis,computational-linguistics,text-mining
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.11.4
Requires-Dist: sqlalchemy>=2.0.41
Requires-Dist: sqlalchemy-stubs>=0.4
Requires-Dist: pandas>=2.2.3
Requires-Dist: spacy>=3.8.6
Requires-Dist: scikit-learn>=1.6.1
Requires-Dist: tqdm>=4.67.1
Requires-Dist: nltk>=3.8.2
Requires-Dist: uvicorn>=0.34.2
Requires-Dist: fastapi>=0.115.12
Requires-Dist: ipython>=8.38.0
Requires-Dist: ipywidgets>=8.1.8
Requires-Dist: nest-asyncio>=1.6.0
Requires-Dist: fastapi_camelcase>=2.0.0
Requires-Dist: psutil>=7.0.0
Requires-Dist: numpy>=2.2.6
Requires-Dist: networkx>=3.4.2
Requires-Dist: kagglehub>=0.4.1
Provides-Extra: coref-fastcoref
Requires-Dist: fastcoref>=2.1.3; extra == "coref-fastcoref"
Provides-Extra: dev
Requires-Dist: pytest~=8.4.1; extra == "dev"
Requires-Dist: ruff==0.14.10; extra == "dev"
Requires-Dist: build>=1.3.0; extra == "dev"
Requires-Dist: twine>=6.2.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5; extra == "docs"
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
Requires-Dist: mkdocs-jupyter>=0.24; extra == "docs"
Requires-Dist: kagglehub>=0.4.1; extra == "docs"
Dynamic: license-file

# narrativegraphs

Turn a collection of texts into an interactive narrative graph of entities and their relations and explore the structure of your corpus visually.

## Installation

```bash
pip install narrativegraphs
```

## Quick Start

```python
from narrativegraphs import NarrativeGraph

docs: list[str] = [...]  # your list of documents
model = NarrativeGraph().fit(docs)
model.serve_visualizer()
```

Open the link in your terminal to explore the graph in your browser:

![visualizer-screenshot.png](https://raw.githubusercontent.com/KasperFyhn/narrativegraphs/refs/heads/main/assets/visualizer-screenshot.png)

## Features
- **Plug'n'play solution** – get started with a few lines of code
- **Interactive browser-based visualizer** – shipped with an interactive React app which can be hosted directly from Python, no extra dependencies
- **See the original contexts** that extracted entities and relations appear in
- **Filter and query the graph** by statistics, category, or timestamps
- **Export graph and data to NetworkX and Pandas** for your own custom analyses
- **Modular structure** – customize or switch out pipeline components to accommodate _your_ use case.

## Documentation

Full documentation and tutorials: [kasperfyhn.github.io/narrativegraphs](https://kasperfyhn.github.io/narrativegraphs)

## Citation

If you use this package in academic work, please cite:

```bibtex
@software{narrativegraphs,
  author = {Fyhn, Kasper},
  title = {narrativegraphs: A Python package for narrative graph analysis},
  year = {2026},
  url = {https://github.com/kasperfyhn/narrativegraphs}
}
```
