or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/python-bidi@0.6.x
tile.json

tessl/pypi-python-bidi

tessl install tessl/pypi-python-bidi@0.6.0

Python Bidi layout wrapping the Rust crate unicode-bidi

Agent Success

Agent success rate when using this tile

93%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.09x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-9/

Multi-Paragraph Text Processor

Create a Python utility that processes multi-paragraph bidirectional text and prepares it for display in a text rendering system. The utility should handle text containing mixed left-to-right (LTR) and right-to-left (RTL) content across multiple paragraphs.

Requirements

Your implementation should provide a function that:

  1. Accepts multi-paragraph text input where paragraphs are separated by newline characters
  2. Processes each paragraph independently for bidirectional text display
  3. Returns the processed text with paragraphs properly reordered for visual display
  4. Handles cases where different paragraphs have different base directions (some LTR, some RTL)

The processor should correctly handle:

  • Multiple paragraphs in a single text block
  • Mixed Hebrew/Arabic and English text within and across paragraphs
  • Proper boundary resets between paragraphs
  • Whitespace preservation at paragraph boundaries

Implementation

@generates

API

def process_multi_paragraph_text(text: str) -> str:
    """
    Process multi-paragraph bidirectional text for display.

    Args:
        text: Input text containing one or more paragraphs separated by newlines

    Returns:
        Processed text with each paragraph properly reordered for display
    """
    pass

Test Cases

  • Given a single paragraph with mixed Hebrew and English text, the function returns properly reordered text for display @test
  • Given two paragraphs where the first contains English text and the second contains Hebrew text, the function processes each paragraph independently and preserves the paragraph boundary @test
  • Given three paragraphs with alternating directions (English, Hebrew, English), each paragraph is processed with correct base direction detection @test
  • Given text with empty lines between paragraphs, the empty lines are preserved in the output @test

Dependencies { .dependencies }

python-bidi { .dependency }

Provides bidirectional text processing support for proper display of mixed LTR/RTL text.