Skip to main content

A package for creating and analyzing narrative graphs from text corpora

Project description

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

pip install narrativegraphs

Quick Start

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

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

Citation

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

narrativegraphs-0.4.0.tar.gz (824.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

narrativegraphs-0.4.0-py3-none-any.whl (450.5 kB view details)

Uploaded Python 3

File details

Details for the file narrativegraphs-0.4.0.tar.gz.

File metadata

  • Download URL: narrativegraphs-0.4.0.tar.gz
  • Upload date:
  • Size: 824.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for narrativegraphs-0.4.0.tar.gz
Algorithm Hash digest
SHA256 91e9fa91a2bf09a0bca4fea387ab867f625c27a7eea752e095ff1880d6c363bf
MD5 e76af29c53a102cba129d52ff42ac4e1
BLAKE2b-256 4cc47c9e906523804bef44038b96e5a868a89d75a3a538ba7c92105c6ed3fa26

See more details on using hashes here.

File details

Details for the file narrativegraphs-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: narrativegraphs-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 450.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for narrativegraphs-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37a1dfd07eb6e0bb73b0ed5cb25d310a9d78d2ed74d402c74c2102ccb9391eeb
MD5 bc7201707d46472deadc7a5de02b0afb
BLAKE2b-256 29b89a67634429e8d19de827e1f96359ce388d376f8fe878485684e666e955fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page