diff options
Diffstat (limited to 'motus/bin')
-rw-r--r-- | motus/bin/motus.ml | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/motus/bin/motus.ml b/motus/bin/motus.ml index fe00a3c..0f2b17b 100644 --- a/motus/bin/motus.ml +++ b/motus/bin/motus.ml @@ -24,7 +24,7 @@ let show_structure : (Format.pp_print_list format_filter) filters; - Format.fprintf format "Got %d elements @\n" data.number; + Format.fprintf format "Got %d elements @\n" (Persistence.list_size data); Format.fprintf format @@ -32,14 +32,14 @@ let show_structure : (Format.pp_print_list (fun f (k, v) -> Format.fprintf f "%c -> %d" k v)) (Persistence.extract_freq data); - if data.number < 20 + if Persistence.list_size data < 20 then Format.fprintf format "Remaining words @[<v>@;%a@]@\n" (Format.pp_print_list ~pp_sep:Format.pp_force_newline (fun f w -> Format.fprintf f "%s" w ) ) - data.element; + (Persistence.words data); Format.close_box () @@ -97,11 +97,7 @@ let rec run filters words = (* if the input is empty, remove the word from the list and restart *) match String.equal String.empty input with - | true -> - let new_words = - List.filter (fun w -> not (String.equal w next)) words.element - in - run filters { words with element = new_words; number = words.number - 1 } + | true -> run filters (Persistence.remove_word words next) | false -> let new_rules = Criteria.merge_lists ~init:filters (create_new_rules next input) @@ -112,7 +108,7 @@ let rec run filters words = List.fold_left (Persistence.add_word new_rules) (Persistence.empty_data ()) - words.element + (Persistence.words words) in run new_rules words |