aboutsummaryrefslogtreecommitdiff
path: root/motus/bin/motus.ml
diff options
context:
space:
mode:
Diffstat (limited to 'motus/bin/motus.ml')
-rw-r--r--motus/bin/motus.ml11
1 files changed, 7 insertions, 4 deletions
diff --git a/motus/bin/motus.ml b/motus/bin/motus.ml
index e32adca..a8a9188 100644
--- a/motus/bin/motus.ml
+++ b/motus/bin/motus.ml
@@ -69,11 +69,14 @@ let create_new_rules word result =
!rules
-let rec run filters words =
+let rec run len filters words =
let () = show_structure Format.std_formatter words filters in
+ (*
let next =
Freq_analysis.analyse words |> Freq_analysis.pick_next_word words
in
+ *)
+ let _, next = Entropy.analyse len words in
let () =
Format.fprintf Format.std_formatter "Next word will be : %s@\n" next
@@ -83,14 +86,14 @@ 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 -> run filters (Wordlist.remove_word words next)
+ | true -> run len filters (Wordlist.remove_word words next)
| false ->
let new_rules =
Criteria.merge_lists ~init:filters (create_new_rules next input)
|> List.sort_uniq Stdlib.compare
in
let words = Wordlist.filter new_rules words in
- run new_rules words
+ run len new_rules words
let init_rule rules word =
@@ -119,4 +122,4 @@ let () =
let words_channel = open_in (List.hd !dict) in
let words = get_list words_channel initial_filter in
close_in words_channel;
- run initial_filter words
+ run !length initial_filter words