mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
small example in lenvenshtein
This commit is contained in:
parent
8e5cde6f29
commit
c5473857f8
1 changed files with 7 additions and 0 deletions
|
|
@ -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;;
|
||||||
|
*)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue