This is the package implementation of the code for the kinship ties and relational information from large text corpora, such as genealogies, biographies, and historical dictionaries.
Important information:
- For example package usage, see
test_workflow.ipynb - For information about individual functions before the package implementation and release, see
examplesfolder.
Expected input files
Each document should normally have these three files together in the same
folder under documents_root:
0_GenelogiesAndBiographies/
├── Example genealogy/
│ ├── Example genealogy_mod.htm # source HTML used for the inventory
│ ├── Example genealogy_mod.pdf # PDF with a readable OCR text layer
│ └── Example genealogy_Original.pdf # original PDF without OCR
└── Biographies/
└── Example biography/
├── Example biography_mod.htm
├── Example biography_mod.pdf
└── Example biography_Original.pdf
The filenames must share the same base name. The package uses the HTML for
inventory creation, prefers *_mod.pdf for page matching, and falls back to
*_Original.pdf, which can be OCRed with Tesseract when necessary.
Current release:
Current release includes inventory creation, setting text bounds, assigning font usage and selecting appropriate text chunks from the files (including restriction to "MainText" fonts and JumPJumP insertion).
Files structure:
Contains the HTMLCleaner class and thus the main logic.
Contains helper functions (like JumPJumP insertion)
Contains the file processing logic, such as loading and saving the JSON inventory.
Adds one-based PDF start_page and end_page values to chunk metadata using
exact and fuzzy text matching. Missing PDFs are skipped with null page values
and explicit filename guidance.
Add PDF page numbers
If you already created an HTMLCleaner, use cleaner.add_pdf_pages(). If you
only have an inventory JSON file, use add_pages_to_inventory_file() directly.
summary = cleaner.add_pdf_pages(
documents_root="../0_GenelogiesAndBiographies",
output_path="exact_html_inventory_new_ids_cleaned_pages.json",
)
The default fuzzy threshold is 0.80. The matcher prefers *_mod.pdf, falls
back to _Original.pdf when needed, and can use Tesseract for image-only
originals when Tesseract is installed.
Release files for text2rel 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| text2rel-0.5.tar.gz | 90.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| text2rel-0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 187.4 kB
Release files / text2rel-0.5.tar.gz
| Download URL | text2rel-0.5.tar.gz |
|---|---|
| Size | 90.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bee59bb118248890c00c0362fdb434c83e4fc4e58147e8e2d92f29d3244b68c8
|
|
BLAKE2b-256 checksum How to use checksums |
19ae069593f7fc00fe180e4babb77ff47dfcd1468ec8b7c70a91714d41a20473
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / text2rel-0.5-py3-none-any.whl
| Download URL | text2rel-0.5-py3-none-any.whl |
|---|---|
| Size | 96.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cdfe649bb7d86faebefcd553fef09900a2c50330c38b925de41da02bc04b279a
|
|
BLAKE2b-256 checksum How to use checksums |
29ce6443be2962d61486472b93b2827b2a875480d513dfe3dccf7b74c75563ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|