From 4eff667b92ff7ef4c3542650509c03fb0de5cbce Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 25 Feb 2022 19:15:29 +0100 Subject: Added an another engine for motus, using entropy instead of frequencies only --- motus/bin/motus.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'motus/bin/motus.ml') 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 -- cgit v1.2.3