Skip to main content

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."
]

retriever = FragmentShotsRetriever(src_texts, tgt_texts, max_fragment_size=5, overlaps=False)

result = retriever.get_fragment_shots("The source of this is unknown.")
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fragmentshot-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

fragmentshot-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file fragmentshot-0.1.2.tar.gz.

File metadata

  • Download URL: fragmentshot-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for fragmentshot-0.1.2.tar.gz
Algorithm Hash digest
SHA256 67b2b56d2fed5596b3ab3c325cda7841fe93237730b285839bccdcf8fd41e45c
MD5 293c711a7e395cc34cdcc8714f719c03
BLAKE2b-256 7056bc2c00b0ce9091c87f65684220556d1929365cc7e7955d05dd5f3d3b34ac

See more details on using hashes here.

File details

Details for the file fragmentshot-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: fragmentshot-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for fragmentshot-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84de058a316b6477c16e1852fca06bd798c56ec4f9f446b8f40130b74ab97518
MD5 7827a4d0d1127ef5ab031257a13d4cf7
BLAKE2b-256 58421d1acb15f3975a0f40ce6945752aef8f807c09932eb64b188176528d5e55

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