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.0.tar.gz (2.2 MB 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.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for narrativegraphs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e7deb797f2270b778678cafae9f6bc6b031de4b9338677ab14b14a31e48d9ca3
MD5 2a462f2011eba578a65ccaf60c58769c
BLAKE2b-256 1bed5492eaac3091029b7062e1b15961a2b475badf86eacc9202fee31b7da1ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativegraphs-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c1dcc28be3ee9b2e1aecaa9d6ddb8e6955918366365cb4265f36beb16a38399
MD5 3a7d83d1113308377c27c96475452082
BLAKE2b-256 c77f098e2987ba5992e8d1d357f042226193dc43f4016766da5693a1459d4243

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