Python compatibility wrapper for computing string edit distances and similarities using fast Levenshtein algorithms.
88
Build a string transformation system that can record, apply, and reverse text editing operations. The system should track changes made to strings and allow replaying or undoing those changes.
Transform Tracker: Create a class TransformTracker that records how to transform one string into another.
Apply Transformation: Implement a method apply_transformation(source_text) that:
Reverse Transformation: Implement a method get_reverse_tracker() that:
TransformTracker objectTransformation Details: Implement a method get_operation_count() that:
Provides fast string edit distance and transformation operations.
# test_transform.py
from transform import TransformTracker
def test_basic_transformation():
tracker = TransformTracker("hello", "hallo")
result = tracker.apply_transformation("hello")
assert result == "hallo"
assert tracker.get_operation_count() == 1# test_transform.py
def test_reverse_transformation():
tracker = TransformTracker("cat", "dog")
reverse = tracker.get_reverse_tracker()
# Apply forward then reverse
forward_result = tracker.apply_transformation("cat")
assert forward_result == "dog"
reverse_result = reverse.apply_transformation("dog")
assert reverse_result == "cat"# test_transform.py
def test_complex_transformation():
tracker = TransformTracker("kitten", "sitting")
result = tracker.apply_transformation("kitten")
assert result == "sitting"
assert tracker.get_operation_count() > 1Install with Tessl CLI
npx tessl i tessl/pypi-python-levenshteindocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10