std.edit
Provides functions to compute and interpret edit distance.
- Author: Edward Jones
- Date: 2021-09-24
closest
Find the closest string to a given one from a list of strings.
- Param
s: A source string - Param
ts: A list of strings
Returns: The t in ts which is closest to s
closest = (s, ts) -> ...
edit_distance
Compute the edit distance between two strings.
- Param
u: A string - Param
v: Another string
Returns: The edit distance between u and v
edit_distance = (u, v) -> ...
unknown_x_msg
Create a suggestion message when an incorrect value was supplied which should have been in a list of options.
- Param
x: The name of the type ofv - Param
v: The incorrect value given - Param
vs: The list of valid values of whichvshould have been a member
Returns: A user-friendly message which suggests the u in vs which is closest to v if it is not too distant
unknown_x_msg = (x, v, vs) -> ...