Skip to main content

Relationships Extraction from NARrative Documents

Project description

Renard

DOI

the Renard logo

Renard (Relationship Extraction from NARrative Documents) is a modular library for creating and using custom character networks extraction pipelines. Renard can extract dynamic as well as static character networks. Renard is modular, in the sense that you can easily create a custom extraction pipeline that fits your needs.

Installation

Currently, Renard supports Python>=3.9,<=3.12. You can install the latest version using pip:

pip install renard-pipeline

If you have a GPU, there are accelerated versions for Nvidia CUDA and AMD ROCm:

pip install renard-pipeline[cuda128] pip install renard-pipeline[rocm63]

Documentation

Documentation, including installation instructions, can be found at https://compnet.github.io/Renard/

If you need local documentation, it can be generated using Sphinx. From the docs directory, make html should create documentation under docs/_build/html.

Interactive Demo

You can check the interactive demo of Renard at HuggingFace. The UI used for the demo is currently in development and will be available directly in Renard in the next version.

Tutorial

Renard's central concept is the Pipeline.A Pipeline is a list of PipelineStep that are run sequentially in order to extract a character graph from a document. Here is a simple example:

from renard.pipeline import Pipeline
from renard.pipeline.tokenization import NLTKTokenizer
from renard.pipeline.ner import NLTKNamedEntityRecognizer
from renard.pipeline.character_unification import GraphRulesCharacterUnifier
from renard.pipeline.graph_extraction import CoOccurrencesGraphExtractor

with open("./my_doc.txt") as f:
	text = f.read()

pipeline = Pipeline(
	[
		NLTKTokenizer(),
		NLTKNamedEntityRecognizer(),
		GraphRulesCharacterUnifier(min_appearance=10),
		CoOccurrencesGraphExtractor(co_occurrences_dist=25)
	]
)

out = pipeline(text)

For more information, see renard_tutorial.py, which is a tutorial in the jupytext format. You can open it as a notebook in Jupyter Notebook (or export it as a notebook with jupytext --to ipynb renard-tutorial.py).

Contributing

see the "Contributing" section of the documentation.

Running tests

Renard uses pytest for testing. To launch tests, use the following command :

uv run python -m pytest tests

Alternatively, the project Makefile has a test target:

make test

Expensive tests are disabled by default. These can be run by setting the environment variable RENARD_TEST_SLOW to 1.

Renard UI

Since version 0.7, Renard has a web interface powered by gradio. First, install the additional dependencies:

uv sync --group ui

Then, simply run:

make ui

And open your browser at http://127.0.0.1:7860

How to cite

If you use Renard in your research project, please cite it as follows:

@Article{Amalvy2024,
  doi	       = {10.21105/joss.06574},
  year	       = {2024},
  publisher    = {The Open Journal},
  volume       = {9},
  number       = {98},
  pages	       = {6574},
  author       = {Amalvy, A. and Labatut, V. and Dufour, R.},
  title	       = {Renard: A Modular Pipeline for Extracting Character
                  Networks from Narrative Texts},
  journal      = {Journal of Open Source Software},
} 

We would be happy to hear about your usage of Renard, so don't hesitate to reach out!

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

renard_pipeline-0.7.1.tar.gz (337.0 kB view details)

Uploaded Source

Built Distribution

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

renard_pipeline-0.7.1-py3-none-any.whl (414.7 kB view details)

Uploaded Python 3

File details

Details for the file renard_pipeline-0.7.1.tar.gz.

File metadata

  • Download URL: renard_pipeline-0.7.1.tar.gz
  • Upload date:
  • Size: 337.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for renard_pipeline-0.7.1.tar.gz
Algorithm Hash digest
SHA256 e43fba51201a5222eae5e9aa0b250f367b52b357d9e80d658d00fcbeee3027be
MD5 cc70ec9e5edf70a631e81e695bd8054c
BLAKE2b-256 580ff1081d830fa9a21ebc04da65fa843476a35749ab92b8e52f6889fd2e9abe

See more details on using hashes here.

File details

Details for the file renard_pipeline-0.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for renard_pipeline-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e326addafcc1ba592c890ce64f6e9c6e2bf78e19f8a1b25e429aed75d56b3844
MD5 ec37a509c6f49b4e578ff9cdd0d3a8a4
BLAKE2b-256 f0e0e10b4cea3e05e8f54b6042ac7db10ab4443e830941f0e78a65a9b146e2fe

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