Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
ShiftedArrays = "1277b4bf-5013-50f5-be3d-901d8477a67a"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
Expand All @@ -23,7 +22,6 @@ DataFrames = "1"
DataStructures = "0.17, 0.18, 0.19"
LinearAlgebra = "<0.0.1, 1"
Printf = "<0.0.1, 1"
REPL = "<0.0.1, 1"
ShiftedArrays = "1, 2"
SparseArrays = "<0.0.1, 1"
Statistics = "1"
Expand Down
2 changes: 0 additions & 2 deletions src/StatsModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ using LinearAlgebra

using Tables: ColumnTable

using REPL: levenshtein

export
#reexport from StatsBase:
StatisticalModel,
Expand Down
19 changes: 19 additions & 0 deletions src/errormessages.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Levenshtein distance
# Copied from the REPL stdlib in JuliaLang/julia (license is MIT: https://julialang.org/license)
function levenshtein(s1, s2)
a, b = collect(s1), collect(s2)
m = length(a)
n = length(b)
d = Matrix{Int}(undef, m+1, n+1)

d[1:m+1, 1] = 0:m
d[1, 1:n+1] = 0:n

for i = 1:m, j = 1:n
d[i+1,j+1] = min(d[i , j+1] + 1,
d[i+1, j ] + 1,
d[i , j ] + (a[i] != b[j]))
end

return d[m+1, n+1]
end

"""
This is borrowed from [DataFrames.jl]().
Expand Down
Loading