CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-python-levenshtein

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

88

1.37x
Overview
Eval results
Files

task.mdevals/scenario-3/

Text Revision Similarity Analyzer

Build a tool that analyzes the similarity between different versions of document drafts by comparing them as sequences of words. The tool should preserve the order of words when computing similarity, making it suitable for tracking how much documents have changed across revisions.

Capabilities

Compare document revisions

  • Given two document versions as lists of words, the analyzer computes their similarity score considering word order @test
  • Given identical document versions, the analyzer returns a similarity score of 1.0 @test
  • Given completely different document versions with no common words, the analyzer returns a similarity score of 0.0 @test

Identify most similar revision

  • Given a target document and multiple candidate revisions, the analyzer identifies which candidate is most similar to the target based on word sequence @test

Implementation

@generates

API

def compute_similarity(doc1: list[str], doc2: list[str]) -> float:
    """
    Computes similarity between two documents represented as word sequences.

    Args:
        doc1: First document as a list of words
        doc2: Second document as a list of words

    Returns:
        float: Similarity score between 0.0 (completely different) and 1.0 (identical)
    """
    pass

def find_most_similar(target: list[str], candidates: list[list[str]]) -> int:
    """
    Finds the index of the most similar document from a list of candidates.

    Args:
        target: Target document as a list of words
        candidates: List of candidate documents, each as a list of words

    Returns:
        int: Index of the most similar candidate document
    """
    pass

Dependencies { .dependencies }

Levenshtein { .dependency }

Provides string similarity algorithms including sequence comparison.

Install with Tessl CLI

npx tessl i tessl/pypi-python-levenshtein

tile.json