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

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


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.1.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.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fragmentshot-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3f06055f87a084963f7bf634eb09a4682528b132ec0274e805a7cb04fb14cb73
MD5 0347b9b57fecde02917dd21bdb83742c
BLAKE2b-256 66eb8e0526660166791ffc2a2d2edf2a1242745408c8c782787ed672c23e8679

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fragmentshot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 865b7139e022275d165c0e17a02e4af41c99e61c2f32b5830c9df3de94c95192
MD5 528627e2fe327286ac40a9947a471eb9
BLAKE2b-256 8422abe0032d399b30201ed3ea0f86006ff4729b72105562524819933cd7ee9b

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