small example in lenvenshtein

This commit is contained in:
Simon Cruanes 2014-03-05 01:09:48 +01:00
parent 8e5cde6f29
commit c5473857f8

View file

@ -555,3 +555,10 @@ module StrIndex = struct
in in
__to_list ~of_list idx __to_list ~of_list idx
end end
(*
open Batteries;;
let words = File.with_file_in "/usr/share/dict/cracklib-small" (fun i -> IO.read_all i |> String.nsplit ~by:"\\n");;
let idx = List.fold_left (fun idx s -> Levenshtein.StrIndex.add_string idx s s) Levenshtein.StrIndex.empty words;;
Levenshtein.StrIndex.retrieve_string ~limit:1 idx "hell" |> Levenshtein.klist_to_list;;
*)