julianschelb/retexo

Word-level explanations of text reuse in Latin literature: align a reusing passage to its source and name the operation behind every link.

Python

0

15 commits

updated Oct 12, 2026

See the code

README

Retexo

CI Docs Dataset PyPI License: MIT

Word-level explanations of text reuse in Latin literature.

When a later author quotes or alludes to an earlier one, the interesting question is how the source was reworked. Retexo answers it word by word: it aligns every word of the reusing passage to the source word it takes up, or to none, and names the operation behind each link, such as a copy, a change of inflection, or a substitution. The result is an edit script: a set of labeled links between two passages that a philologist can read and contest.

Retexo learns these scripts from very little annotation. Synthetic pairs, built by applying known operations to Latin text, teach a pointer network the task before a single pair is annotated, and active learning chooses the few pairs an annotator corrects.

Quick start

pip install retexo

Read the predictions, with the Hugging Face datasets library:

from datasets import load_dataset

scripts = load_dataset("julian-schelb/latin-classical-intertextuality-edit-scripts", split="fold_4")
pair = scripts[0]

for link in pair["links"]:
    print(pair["reuse"]["tokens"][link["reuse"]], "<-", pair["source"]["tokens"][link["source"]], link["label"])

Convert the raw predictions of a run into the same format:

retexo export runs/f0/predictions.jsonl runs/f1/predictions.jsonl runs/f2/predictions.jsonl \
              runs/f3/predictions.jsonl runs/f4/predictions.jsonl --out export/ --format parquet

Labels

LabelMeaning
COPYthe same form, spelling variants folded
INFLECTthe same lemma in another form
SUBSTanother lemma in the same slot, optionally with a named relation such as a synonym
SPLIT, MERGEtwo reuse words for one source word, or one for two
INS, FRAME, DELan unlinked reuse word, a word of a citing formula, an unclaimed source word

See the documentation for the conventions.

Repository layout

src/retexo/         the package: model, generator, active learning, baselines, scorer
src/retexo_gui/     Gradio demo and annotation app (gui extra)
tests/              pytest suite
examples/           notebooks on the operations, the generator, the passage class and the decoder
docs/               documentation (MkDocs)
webapp/             the review app (React, Vite), published under /demo/

The experiments behind the paper live in a separate repository that installs retexo as a dependency.

Development

pip install -e ".[dev,lexical]"
pytest
mkdocs serve

See docs/development.md.

Authors

Julian Schelb (University of Konstanz), Michael Wittweiler (University of Zurich), Marie Revellio (University of Konstanz).

License

MIT

digital-humanities
intertextuality
latin
nlp
text-reuse

julianschelb/retexo

Word-level explanations of text reuse in Latin literature: align a reusing passage to its source and name the operation behind every link.

Python

0

15 commits

updated Oct 12, 2026

See the code

README

Retexo

CI Docs Dataset PyPI License: MIT

Word-level explanations of text reuse in Latin literature.

When a later author quotes or alludes to an earlier one, the interesting question is how the source was reworked. Retexo answers it word by word: it aligns every word of the reusing passage to the source word it takes up, or to none, and names the operation behind each link, such as a copy, a change of inflection, or a substitution. The result is an edit script: a set of labeled links between two passages that a philologist can read and contest.

Retexo learns these scripts from very little annotation. Synthetic pairs, built by applying known operations to Latin text, teach a pointer network the task before a single pair is annotated, and active learning chooses the few pairs an annotator corrects.

Quick start

pip install retexo

Read the predictions, with the Hugging Face datasets library:

from datasets import load_dataset

scripts = load_dataset("julian-schelb/latin-classical-intertextuality-edit-scripts", split="fold_4")
pair = scripts[0]

for link in pair["links"]:
    print(pair["reuse"]["tokens"][link["reuse"]], "<-", pair["source"]["tokens"][link["source"]], link["label"])

Convert the raw predictions of a run into the same format:

retexo export runs/f0/predictions.jsonl runs/f1/predictions.jsonl runs/f2/predictions.jsonl \
              runs/f3/predictions.jsonl runs/f4/predictions.jsonl --out export/ --format parquet

Labels

LabelMeaning
COPYthe same form, spelling variants folded
INFLECTthe same lemma in another form
SUBSTanother lemma in the same slot, optionally with a named relation such as a synonym
SPLIT, MERGEtwo reuse words for one source word, or one for two
INS, FRAME, DELan unlinked reuse word, a word of a citing formula, an unclaimed source word

See the documentation for the conventions.

Repository layout

src/retexo/         the package: model, generator, active learning, baselines, scorer
src/retexo_gui/     Gradio demo and annotation app (gui extra)
tests/              pytest suite
examples/           notebooks on the operations, the generator, the passage class and the decoder
docs/               documentation (MkDocs)
webapp/             the review app (React, Vite), published under /demo/

The experiments behind the paper live in a separate repository that installs retexo as a dependency.

Development

pip install -e ".[dev,lexical]"
pytest
mkdocs serve

See docs/development.md.

Authors

Julian Schelb (University of Konstanz), Michael Wittweiler (University of Zurich), Marie Revellio (University of Konstanz).

License

MIT

digital-humanities
intertextuality
latin
nlp
text-reuse

Project health

PyPI

Latest release

0.1.0 · Oct 4, 2026

Releases this year

1