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-7/

Text Diff Highlighter

Build a simple text difference visualization tool that identifies and displays common unchanged sections between two versions of text.

Capabilities

Identifies common text blocks

  • Given two strings "hello world" and "hello there world", it identifies common blocks including "hello " at the start of both strings @test

Handles strings with no common blocks

  • Given two completely different strings like "abc" and "xyz", it returns an empty list of common blocks @test

Handles identical strings

  • Given two identical strings like "test" and "test", it identifies the entire string as one common block @test

Handles strings with multiple scattered blocks

  • Given "the quick brown fox" and "the slow brown dog", it identifies multiple common blocks: "the " and "brown " @test

Implementation

@generates

The tool should analyze two input strings and return information about all contiguous sequences that are common between them. Each common block should include:

  • The starting position in the first string
  • The starting position in the second string
  • The length of the common sequence

API

def find_common_blocks(text1: str, text2: str) -> list:
    """
    Finds all contiguous common subsequences between two strings.

    Args:
        text1: The first text string
        text2: The second text string

    Returns:
        A list of tuples, where each tuple contains:
        (start_position_in_text1, start_position_in_text2, block_length)

    Example:
        find_common_blocks("hello world", "hello there world")
        Returns: [(0, 0, 6), (6, 12, 5)]
    """
    pass

Dependencies { .dependencies }

Levenshtein { .dependency }

Provides string comparison and edit distance algorithms.