diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-02-25 19:15:29 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-25 19:15:29 +0100 |
commit | 4eff667b92ff7ef4c3542650509c03fb0de5cbce (patch) | |
tree | 6a6180d355d0ab78626ad5988c5203ee20344187 /motus/bin | |
parent | 95432043550bd4a41b4466395502bc3b748e6746 (diff) |
Added an another engine for motus, using entropy instead of frequencies only
Diffstat (limited to 'motus/bin')
-rw-r--r-- | motus/bin/motus.ml | 11 |
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 |