aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-03-01 13:31:38 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-03-01 13:31:38 +0100
commitc5656ff7531b473fbd88a8bc3ce2ad9366aeb53d (patch)
tree5928ff6b2e61fa7a065200b6f20e9a7cf66e51cf
parente3088560b6eac99c39338af24c3ef8c81f379ea6 (diff)
Correction
-rw-r--r--motus/lib/entropy.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/motus/lib/entropy.ml b/motus/lib/entropy.ml
index fba14ce..5fcef6c 100644
--- a/motus/lib/entropy.ml
+++ b/motus/lib/entropy.ml
@@ -38,7 +38,7 @@ let get_entropy max_element words_number arr =
let ratio = content /. words_number in
entropy := !entropy -. (ratio *. Float.log2 ratio)
done;
- entropy
+ !entropy
let analyse : int -> catalog:Wordlist.t -> Wordlist.t -> t =
@@ -86,10 +86,10 @@ let analyse : int -> catalog:Wordlist.t -> Wordlist.t -> t =
word to if it belongs to the final list (it gives a small chance
to pick the right one…) *)
let is_better, already_picked =
- if !entropy > score
+ if entropy > score
then (true, false)
else if (not already_picked)
- && !entropy == score
+ && entropy == score
&& Wordlist.mem word_ref words
then (true, true)
else (false, already_picked)
@@ -100,8 +100,8 @@ let analyse : int -> catalog:Wordlist.t -> Wordlist.t -> t =
Printf.printf
"Q. of information when selecting %s : %f\n"
word_ref
- !entropy;
- (!entropy, word_ref, already_picked) )
+ entropy;
+ (entropy, word_ref, already_picked) )
else (score, word, already_picked) )
(-0., v, false)
(Wordlist.words catalog)