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

Spell Checker Suggestions

Build a spell checking utility that finds the closest matching words from a dictionary for potentially misspelled input words.

Capabilities

Find closest match

  • Given a dictionary of valid words and a potentially misspelled word, returns the closest matching word based on edit distance @test
  • When the input word exactly matches a dictionary word, returns that word with distance 0 @test
  • When multiple words have equal minimum distance, returns the first match found @test

Implementation

@generates

API

def find_closest_match(word: str, dictionary: list[str]) -> tuple[str, int]:
    """
    Finds the closest matching word from a dictionary.

    Args:
        word: The potentially misspelled word to check
        dictionary: List of valid words to compare against

    Returns:
        A tuple containing (closest_word, distance) where closest_word
        is the best match from the dictionary and distance is the
        minimum edit distance found
    """
    pass

Dependencies { .dependencies }

Levenshtein { .dependency }

Provides string edit distance calculation support.

Install with Tessl CLI

npx tessl i tessl/pypi-python-levenshtein

tile.json