or run

tessl search
Log in

Version

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

tessl/pypi-python-levenshtein

tessl install tessl/pypi-python-levenshtein@0.27.0

Python compatibility wrapper for computing string edit distances and similarities using fast Levenshtein algorithms.

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.38x

Baseline

Agent success rate without this tile

64%

task.mdevals/scenario-9/

String Transformation Reversal System

Build a bidirectional string transformation system that can transform strings and reverse those transformations.

Requirements

Implement a module that provides bidirectional string transformation capabilities:

  1. Transform a source string to a target string and compute the edit operations
  2. Reverse the transformation by applying inverse operations to go back to the original string
  3. Validate that applying forward and inverse operations results in the original string

Functionality

Your implementation should:

  • Accept two strings (source and target) and compute the transformation from source to target
  • Generate the reverse transformation that can convert target back to source
  • Apply both forward and inverse transformations and verify correctness
  • Return results showing both the transformed string and the result of applying the inverse transformation

Expected Behavior

The system should demonstrate bidirectional transformations:

  • When transforming "hello" to "hallo", it should compute operations to perform this change
  • The inverse operations should transform "hallo" back to "hello"
  • The system should verify that applying inverse operations correctly reverses the transformation

Test Cases

  • Transforming "kitten" to "sitting" and back should return "kitten" @test
  • Transforming "flaw" to "lawn" and applying inverse should return "flaw" @test
  • Empty string transformations should handle inverse operations correctly @test

Implementation

@generates

API

def transform_and_reverse(source: str, target: str) -> dict:
    """
    Transforms source to target, then applies inverse transformation.

    Args:
        source: The original string
        target: The string to transform into

    Returns:
        A dictionary containing:
        - 'forward_result': Result of transforming source to target
        - 'inverse_result': Result of applying inverse transformation to target
        - 'matches_source': Boolean indicating if inverse result matches source
    """
    pass

Dependencies { .dependencies }

Levenshtein { .dependency }

Provides string edit distance computation and transformation operations.