realmPath
untyped stringValue
"gno.land/r/moul/x/allinone/textlab/v0"
maxInput
untyped bigintmaxInput bounds what a render path can carry into the algorithms below. levenshtein.Matrix is O(len(a) \* len(b)), so an unbounded pair of inputs is a way to make a query expensive for whoever serves it.
Value
(64 <untyped> bigint)
defaultWord
untyped stringdefaultWord is what the root view demonstrates, chosen because it is the textbook case where the two similarity measures disagree: "knight" and "night" sound identical to soundex and are one edit apart.
Value
"knight"
Render
func(path string) stringRender takes its input from the path: one word, or two separated by "/".
- OID
- 03189e…deca:3
Render details
tooLong
func(s string) bool- OID
- 03189e…deca:5
tooLong details
renderOne
func(word string) stringrenderOne is every single-input algorithm, one row each. ui.Cell, not ui.Inline: these land in table cells, where an unescaped pipe would silently eat a column. The input is whatever someone put in a URL.
- OID
- 03189e…deca:6
renderOne details
romanOf
func(word string) stringromanOf shows the round trip both ways, because romannum is the one package here whose input is a number rather than a word. FromRoman PANICS on anything that is not a roman numeral rather than returning zero, and the input here comes out of a URL, so it is screened first. Without that screen the DEFAULT view aborts: "knight" is not a roman numeral, and neither is most of what anyone would type.
- OID
- 03189e…deca:7
romanOf details
isRomanNumeral
func(s string) boolisRomanNumeral reports whether every byte is a roman digit. It is a screen for romanOf, not a validity check: "IIII" passes here and FromRoman decides.
- OID
- 03189e…deca:8
isRomanNumeral details
renderPair
func(a string, b string) stringrenderPair is the comparison, and the reason this realm exists: the two similarity measures answer different questions, and a reader should watch them disagree rather than be told they might.
- OID
- 03189e…deca:9
renderPair details
yesNo
func(b bool) string- OID
- 03189e…deca:10
yesNo details
renderTry
func() string- OID
- 03189e…deca:11