Skip to content

takumi34/elm-levenstein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm levenstein

leven: String -> String -> Int
leven s1 s2 =
    if String.length s1 == 0 then
            String.length s2
    else if String.length s2 == 0 then
            String.length s1
    else 
          if right 1 s1 == right 1 s2 then
            leven (dropRight 1 s1) (dropRight 1 s2) -- 右端の文字が同じなら切り捨て
          else
            Maybe.withDefault 0
            (List.minimum [leven (dropRight 1 s1) s2,
                  leven s1 (dropRight 1 s2),
                  leven (dropRight 1 s1) (dropRight 1 s2)]) + 1

About

levenstein distanceを算出するサイト

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published