Closed dyphire closed 6 months ago
这语法解释器不会运行 goto continue
后把 ::continue::
后面的 end
视作 if
的结束符了吧
试试这个能不能用
function jaro(s1, s2)
local match_window = math.floor(math.max(#s1, #s2) / 2.0) - 1
local matches1 = {}
local matches2 = {}
local m = 0;
local t = 0;
for i = 0, #s1, 1 do
local start = math.max(0, i - match_window)
local final = math.min(i + match_window + 1, #s2)
for k = start, final, 1 do
if not (matches2[k] or s1[i] ~= s2[k]) then
matches1[i] = true
matches2[k] = true
m = m + 1
break
end
end
end
if m == 0 then
return 0.0
end
local k = 0
for i = 0, #s1, 1 do
if matches1[i] then
while not matches2[k] do
k = k + 1
end
if s1[i] ~= s2[k] then
t = t + 1
end
k = k + 1
end
end
t = t / 2.0
return (m / #s1 + m / #s2 + (m - t) / m) / 3.0
end
试试这个能不能用
测试了下脚本可以正常工作了
参见 https://github.com/eko5624/mpv-macos-intel/issues/9 在 mac 平台使用 luajit 编译的 mpv 无法支持此脚本的语法