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/js/next.ml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'motus/js/next.ml') diff --git a/motus/js/next.ml b/motus/js/next.ml index 104b3e6..f3bb2fe 100644 --- a/motus/js/next.ml +++ b/motus/js/next.ml @@ -6,24 +6,24 @@ type t = unit let process : t -> State.state -> State.state = fun () state -> - (* Add the current proposition into the validated list *) + (* Get the news rules (and match the words only against the new ones )*) let rules = State.get_current_rules state.current_prop in + (* Update the word list with the new rules *) + let analysis = Motus_lib.Wordlist.filter rules state.analysis in + let rules = Motus_lib.Criteria.merge_lists ~init:state.rules rules |> List.sort_uniq ~cmp:Stdlib.compare in - (* Update the word list with the new rules *) - let analysis = Motus_lib.Wordlist.filter rules state.analysis in - let propositions = state.current_prop :: state.propositions and current_prop = [] in let new_state = { state with propositions; current_prop; rules; analysis } in (* Get the new proposition if any *) - let current_prop = Initialize.get_proposition analysis rules in + let current_prop = Initialize.get_proposition state.length analysis rules in match current_prop with | None -> new_state | Some prop -> -- cgit v1.2.3