Metadata-Version: 2.4
Name: narrativegraphs
Version: 0.5.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.5
Requires-Dist: sqlalchemy>=2.0.10
Requires-Dist: pandas>=2.0
Requires-Dist: spacy>=3.8.2
Requires-Dist: scikit-learn>=1.3
Requires-Dist: tqdm>=4.60
Requires-Dist: nltk>=3.9.1
Requires-Dist: uvicorn>=0.30
Requires-Dist: fastapi>=0.100
Requires-Dist: nest-asyncio>=1.5
Requires-Dist: fastapi_camelcase>=2.0.0
Requires-Dist: psutil>=5.9
Requires-Dist: numpy>=1.26
Requires-Dist: networkx>=3.0
Requires-Dist: anthropic>=1.0.0
Requires-Dist: openai>=1.30
Provides-Extra: coref-fastcoref
Requires-Dist: fastcoref>=2.1.3; extra == "coref-fastcoref"
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}
}
```
