Prompt generation for Fragment-Shot and Pivoted Fragment-Shot translation using LLMs
Project description
FragmentShot Retriever
A Python package for retrieving exemplary translations for text based on fragments from parallel corpora.
Features
- Fragment extraction from source and target texts
- Configurable maximum fragment size
- Option to enable or disable fragment overlaps
- Easy integration for retrieval workflows
Installation
You can install this package locally:
pip install .
Or clone the repo and install in editable mode:
git clone https://github.com/schtailmuel/fragmentshot.git
cd fragmentshot
pip install -e .
Usage
from fragmentshot.retriever import FragmentShotsRetriever
src_texts = [
"This is a sample source sentence.",
"Another example source sentence."
]
tgt_texts = [
"Dies ist ein Beispiel im Zieltext.",
"Noch ein Beispiel."
]
result = FragmentShotsRetriever(src_texts, tgt_texts, max_fragment_size=5, overlaps=False)
# Access extracted shots
print(result)
Testing
Run unit tests with:
python -m unittest discover tests
License
This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
Created by Samuel Frontull
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 fragmentshot-0.1.0.tar.gz.
File metadata
- Download URL: fragmentshot-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfcc5c3203f9bcb42e0eca8ac73bd9f688fb7ea47d25a2446e59d622f57b4c3f
|
|
| MD5 |
0cb97f0b0e54768c6794590b263377c3
|
|
| BLAKE2b-256 |
496d28bbda1dfed6fe8e5476b0abcd1eeece4603c3c9131d5574bbf9c88dbd71
|
File details
Details for the file fragmentshot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fragmentshot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43ec27afa8487675ca6263afe4e9332a0cf4683dcfd8afc8a00e4cfc0d03ccc
|
|
| MD5 |
915a416d06c626cfc601eb6882745d3b
|
|
| BLAKE2b-256 |
e0663009e63301211f4f8667b2c18a7ee60ef4b2dc77ef852f01cf4945a7d515
|