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.3.2.tar.gz (815.6 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.3.2-py3-none-any.whl (445.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for narrativegraphs-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c8cb9af3a68f7a375ef5e30f5b4a8bababcb7c3acd0bd2a4e3d023740b5875b9
MD5 6dfb74585da218c86ace2a4437833f49
BLAKE2b-256 9f77f9201232e317a10db2883a6e50fb100015638ce4aac7e46f0479cdbaf193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativegraphs-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9a2ec5acb411d3e5496a21e8e36a6683b412dd27d50fc855e4bc3bb12170c56
MD5 9d530393ca2dbf7114d2ccf242aeb3c4
BLAKE2b-256 3c44cf06004aa7f99f8dd99957e42946a85522ed299e00d3dc1c9e6ad4f70ed1

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