Skip to main content

Parallel text extraction and processing customizable pipeline

Project description

Patee

test PyPI - Wheel PyPI - Python Version

Patee (Parallel Text Extraction and Processing Pipeline) is a Python library designed for processing and extracting text from monolingual or multilingual documents in different languages.

It provides a flexible pipeline architecture for working with multilingual content.

The library allows users to extract, align, and process text across language pairs in a structured manner.

Installation:

pip install patee

How it Works

Patee operates through a configurable pipeline system:

  1. Configuration: Pipelines are defined in YAML files (e.g., pdf.yml that specify processing steps.

  2. Source Documents: The library works with document sources such as:

    • MultilingualSingleFile: Represents a single document mixing multiple languages
    • MonolingualSingleFilePair: Pairs two documents in different languages for parallel processing
  3. Processing Flow:

    • The pipeline is initialized with a configuration file
    • Documents are loaded into the pipeline
    • Each configured step is executed sequentially
    • Processing parameters can be controlled (e.g., page ranges via PageInfo)
    • Results are collected and made available after pipeline execution
  4. Execution: The pipeline is executed via the run() method, which returns a result object indicating whether processing completed successfully.

Run modes

Patee supports two run modes:

  1. Non-persistent: All processing is done in memory, and step results are not saved
result = pipeline.run(source)
  1. Persistent run: Every step result is saved to disk, allowing for later retrieval and analysis
result = pipeline.run(source, Path("path/to/dir"))

Available Pipeline Steps

There are two types of pipelines available in Patee:

  • Extract steps: Should be the first step in the pipeline and retrieves the initial texts pair to start the processing
  • Process steps: Process the extracted texts and can be used in any order after the first extract step

Available Extract Steps

  • text_reader_extractor: Extract text from sources in text format (e.g., TXT)
  • docling_extractor: Extracts text from different document formats using the docling library. Supported formats include PDF, DOCX, HTML and more. The full list can be found here.

Available Process Steps

  • noop_step_processor: Test step that does nothing
  • human_in_the_loop_processor: A step that requires human input to process the text

human_in_the_loop_processor details

This step only works in persistent mode. In non-persistent mode, it is ignored.

It stops the pipeline execution to perform a human revision/edition of the text.

In the first execution of the step:

  • The text of the previous step is persisted
  • A marker file is created (patee_rename_me_to_done_when_human_in_the_loop_is_done)
  • The pipeline execution is stopped and returns a stopped execution result

When the human revision is done, the user should rename the marker file to patee_done and run the pipeline again.

The pipeline will then continue from the last step.

Example Usage

You can explore different examples in the samples directory.

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

patee-0.4.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

patee-0.4.0-py2.py3-none-any.whl (21.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file patee-0.4.0.tar.gz.

File metadata

  • Download URL: patee-0.4.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for patee-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c4ac22dba55745319f2b3f28cc56a874549a22b3a674e0c1f2d1387e2cf090a8
MD5 bbd570181ec88e5c2558cdebc7fd9673
BLAKE2b-256 0b33a488e4ee26731e1cc2ab4396373e331d572ec6a190190dfce0a3bc2419ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for patee-0.4.0.tar.gz:

Publisher: publish.yml on hbiarge/patee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patee-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: patee-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for patee-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 74f8331a835fafa36f1765496274e387a33535ef5be172d148c81a4c88720879
MD5 93709cb439a92911a0e07e74dd2172c9
BLAKE2b-256 363f3f581c74e1d82f384a629b1b05afcfc9bc359090c1e3a173465b567f7a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for patee-0.4.0-py2.py3-none-any.whl:

Publisher: publish.yml on hbiarge/patee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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