From 2b7e96835e75e0d153e7f993d1c4fc2add452ddd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 8 Feb 2026 22:47:02 -0500 Subject: Added Text.distance(a,b) for text similarity comparisons. --- test/text.tm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/text.tm b/test/text.tm index 6c23042d..8f0da922 100644 --- a/test/text.tm +++ b/test/text.tm @@ -208,3 +208,11 @@ func main() assert "one two".find("two") == 5 assert "one two".find("three") == none assert "one two".find("o", start=2) == 7 + + + assert "hello".distance("hello") == 0 + assert "hello".distance("goodbye") > 2.0 + assert "hello".distance("hola") < "hello".distance("goodbye") + assert "hello".distance("Hello") <= 1.0 + assert "hello".distance("xello") <= 1.0 + assert "hello".distance("ehllo") <= "hello".distance("XXllo") -- cgit v1.2.3