]> git.puffer.fish Git - matthieu/gru.git/commitdiff
make weighted probabilities depending on node's children children count
authorMatthieu Pignolet <matthieu@matthieu-dev.xyz>
Thu, 6 Jun 2024 10:11:49 +0000 (14:11 +0400)
committerMatthieu Pignolet <matthieu@matthieu-dev.xyz>
Thu, 6 Jun 2024 10:11:49 +0000 (14:11 +0400)
autofeur_db/src/trie.rs
discordjs/src/index.mjs

index b202a97a4a24b1e8c0196b74803bc17dd94a36ef..bbc2a93b32f592ade57a6f724b547d2a6c3ec14b 100644 (file)
@@ -112,7 +112,7 @@ impl<'a> Trie<'a> {
                 current_node
                     .child_nodes
                     .iter()
-                    .map(|(_, node)| node.child_count),
+                    .map(|(_, node)| node.child_count / (length + 1)),
             )
             .expect("distribution creation should be valid");
 
index 94499e554739c96d16788b0f567ee2af51802660..c28c65d0c920fad47483d5cefebabb4907f41c8c 100644 (file)
@@ -1,5 +1,5 @@
 // Require the necessary discord.js classes
-import { Client, GatewayIntentBits } from 'discord.js';
+import { Client, GatewayIntentBits, Message } from 'discord.js';
 import { request } from "undici";
 
 // Create a new client instance
@@ -42,6 +42,7 @@ client.on("messageCreate", async (message) => {
 
   try {
     // Get the completed word found by the db.
+    
     let response = await completeWord(cutWord(message.cleanContent));
 
     // Ignore if there is no completion