LociSimiles is a Python package for finding intertextual links in Latin literature using pre-trained language models.
Project description
Loci Similes
LociSimiles is a Python package for finding intertextual links in Latin literature using pre-trained language models.
Basic Usage
# Load example query and source documents
query_doc = Document("../data/hieronymus_samples.csv")
source_doc = Document("../data/vergil_samples.csv")
# Load the pipeline with pre-trained models
pipeline = ClassificationPipelineWithCandidategeneration(
classification_name="...",
embedding_model_name="...",
device="cpu",
)
# Run the pipeline with the query and source documents
results = pipeline.run(
query=query_doc, # Query document
source=source_doc, # Source document
top_k=3 # Number of top similar candidates to classify
)
pretty_print(results)
# Save results to CSV or JSON
pipeline.to_csv("results.csv")
pipeline.to_json("results.json")
Command-Line Interface
LociSimiles provides a command-line tool for running the pipeline directly from the terminal:
Basic Usage
locisimiles query.csv source.csv -o results.csv
Advanced Usage
locisimiles query.csv source.csv -o results.csv \
--classification-model julian-schelb/PhilBerta-class-latin-intertext-v1 \
--embedding-model julian-schelb/SPhilBerta-emb-lat-intertext-v1 \
--top-k 20 \
--threshold 0.7 \
--device cuda \
--verbose
Options
-
Input/Output:
query: Path to query document CSV file (columns:seg_id,text)source: Path to source document CSV file (columns:seg_id,text)-o, --output: Path to output CSV file for results (required)
-
Models:
--classification-model: HuggingFace model for classification (default: PhilBerta-class-latin-intertext-v1)--embedding-model: HuggingFace model for embeddings (default: SPhilBerta-emb-lat-intertext-v1)
-
Pipeline Parameters:
-k, --top-k: Number of top candidates to retrieve per query segment (default: 10)-t, --threshold: Classification probability threshold for filtering results (default: 0.5)
-
Device:
--device: Chooseauto,cuda,mps, orcpu(default: auto-detect)
-
Other:
-v, --verbose: Enable detailed progress output-h, --help: Show help message
Output Format
The CLI saves results to a CSV file with the following columns:
query_id: Query segment identifierquery_text: Query text contentsource_id: Source segment identifiersource_text: Source text contentsimilarity: Cosine similarity score (0-1)probability: Classification confidence (0-1)above_threshold: "Yes" if probability ≥ threshold, otherwise "No"
Optional Gradio GUI
Install the optional GUI extra to experiment with a minimal Gradio front end:
pip install locisimiles[gui]
Launch the interface from the command line:
locisimiles-gui
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file locisimiles-1.3.0.tar.gz.
File metadata
- Download URL: locisimiles-1.3.0.tar.gz
- Upload date:
- Size: 52.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06c4f147c9899b09286267a346d41f417acccc7b908a6ceedc784c7990069cfd
|
|
| MD5 |
7974e62fabb4e89fe8b049dacd89f660
|
|
| BLAKE2b-256 |
867e2df827cd9b2adab16bc48c2e09ce3694c808c496d986b11b57ace1cb9a07
|
Provenance
The following attestation bundles were made for locisimiles-1.3.0.tar.gz:
Publisher:
release.yml on julianschelb/locisimiles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locisimiles-1.3.0.tar.gz -
Subject digest:
06c4f147c9899b09286267a346d41f417acccc7b908a6ceedc784c7990069cfd - Sigstore transparency entry: 1003408018
- Sigstore integration time:
-
Permalink:
julianschelb/locisimiles@bdb7b9ee0ad9110d5b1f02ff8c32b968f8bd9047 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/julianschelb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bdb7b9ee0ad9110d5b1f02ff8c32b968f8bd9047 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file locisimiles-1.3.0-py3-none-any.whl.
File metadata
- Download URL: locisimiles-1.3.0-py3-none-any.whl
- Upload date:
- Size: 68.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42254710978d6a94fc1cb4f926052ab2a7d60717ebffced011397bc21a8396c5
|
|
| MD5 |
7af68a90cf03bb235ba1bd4442d0e9b8
|
|
| BLAKE2b-256 |
4058f4847c841f88eb2169d160cb18c709c648c45cd91ad25e991dfa9e14ef05
|
Provenance
The following attestation bundles were made for locisimiles-1.3.0-py3-none-any.whl:
Publisher:
release.yml on julianschelb/locisimiles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locisimiles-1.3.0-py3-none-any.whl -
Subject digest:
42254710978d6a94fc1cb4f926052ab2a7d60717ebffced011397bc21a8396c5 - Sigstore transparency entry: 1003408032
- Sigstore integration time:
-
Permalink:
julianschelb/locisimiles@bdb7b9ee0ad9110d5b1f02ff8c32b968f8bd9047 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/julianschelb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bdb7b9ee0ad9110d5b1f02ff8c32b968f8bd9047 -
Trigger Event:
workflow_run
-
Statement type: