Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

levenshtein package

Overview

Package levenshtein ports the classic Levenshtein edit-distance algorithm (as found in Go libraries like agext/levenshtein) to a gno.land realm.

The core is the textbook dynamic-programming matrix: the minimum number of single-character insertions, deletions, or substitutions to turn string a into string b. It is fully rune-aware and pure (deterministic), so it runs happily on-chain.

Function

Matrix

func Matrix(a, b string) [][]int

Matrix returns the full (len(a)+1) x (len(b)+1) DP matrix used by Distance. matrix[i][j] is the edit distance between the first i runes of a and the first j runes of b. The bottom-right cell equals Distance(a, b).

Params

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/levenshtein.Matrix(,)"

Result