diff options
Diffstat (limited to 'motus/js/initialize.ml')
-rw-r--r-- | motus/js/initialize.ml | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/motus/js/initialize.ml b/motus/js/initialize.ml index a088a0e..9d07a85 100644 --- a/motus/js/initialize.ml +++ b/motus/js/initialize.ml @@ -17,11 +17,17 @@ type t = The rule list is used to identify the letter already fixed by the previous results. *) -let get_proposition : Wordlist.t -> Criteria.t list -> State.proposition option - = - fun analysis rules -> +let get_proposition : + int -> Wordlist.t -> Criteria.t list -> State.proposition option = + fun length wordlist rules -> + Printf.printf "Number of elements : %d\n" (Wordlist.list_size wordlist); + let word = - Freq_analysis.analyse analysis |> Freq_analysis.pick_next_word analysis + if Wordlist.list_size wordlist > 2000 + then Freq_analysis.analyse wordlist |> Freq_analysis.pick_next_word wordlist + else + let _, word = Entropy.analyse length wordlist in + word in match String.equal String.empty word with | true -> None @@ -63,7 +69,7 @@ let process { sender; length; content; proposition } state = |> Wordlist.add_words rules in - let current_prop = get_proposition analysis rules + let current_prop = get_proposition length analysis rules and fields = FieldList.make length sender in ( match current_prop with | None -> state |