(43 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Text.distance 3 2026-02-08 "Tomo man-pages"6 .SH NAME7 Text.distance \- distance between two texts8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Text.distance\ :\ func(a:\ Text,\ b:\ Text,\ language:\ Text\ =\ "C"\ ->\ Num)13 .fi14 .SH DESCRIPTION15 Get an approximate distance between two texts, such that when the distance is small, the texts are similar and when the distance is large, the texts are dissimilar.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 a Text The first text to compare. -26 b Text The second text to compare. -27 language Text The ISO 639 language code for which character width to use. "C"28 .TE29 .SH RETURN30 The distance between the two texts (larger means more dissimilar).32 .SH NOTES33 The exact distance algorithm is not specified and may be subject to change over time.35 .SH EXAMPLES36 .EX37 assert "hello".distance("hello") == 038 texts := &["goodbye", "hello", "hallo"]39 texts.sort(func(a,b:&Text) a.distance("hello") <> b.distance("hello"))40 assert texts == ["hello", "hallo", "goodbye"]41 .EE42 .SH SEE ALSO43 .BR Tomo-Text (3)