Expand description
Text helpers: code-fence stripping, truncation, {key} templating, edit distance.
Small text helpers shared across the workspace: code-fence stripping,
character-safe truncation, {key} templating and edit distance.
Functionsยง
- interpolate_
with - Replace each
{expr}intemplatewith the valuelookupgives forexpr(trimmed): a string verbatim, any other JSON value as its JSON text. An unknownexprbecomes the empty string; an unclosed{is kept as written. - levenshtein
- Edit distance between
aandb, counted in characters (insert, delete and substitute each cost 1). - strip_
code_ fence textwithout a surrounding Markdown code fence, for parsing the JSON a model wrapped in one.- truncate_
chars - The first
max_charscharacters ofs, cut on a character boundary. - truncate_
with_ marker s, or its firstmax_charscharacters followed bymarkerwhen it is longer. The result ismax_charsplus the marker at most.