--!native --!optimize 2 -- Compiled with roblox-ts v3.0.0 local TS = _G[script] local SubString = TS.import(script, script.Parent.Parent, "Utils", "SubString") --[[ * * Generates a Set of unique n-grams from a string. * @example "apple" → {"app", "ppl", "ple"} (n=3) ]] local function NGramSetTokenization(str, n) local n_grams = {} do local i = 0 local _shouldIncrement = false while true do if _shouldIncrement then i += 1 else _shouldIncrement = true end if not (i <= #str - n) then break end local _arg0 = SubString(str, i, i + n) n_grams[_arg0] = true end end return n_grams end return { NGramSetTokenization = NGramSetTokenization, }