From: Matthieu Pignolet Date: Thu, 6 Jun 2024 10:11:49 +0000 (+0400) Subject: make weighted probabilities depending on node's children children count X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d46c5d9d7cd4398abe22d45fc2a47583658514ca;p=matthieu%2Fgru.git make weighted probabilities depending on node's children children count --- diff --git a/autofeur_db/src/trie.rs b/autofeur_db/src/trie.rs index b202a97..bbc2a93 100644 --- a/autofeur_db/src/trie.rs +++ b/autofeur_db/src/trie.rs @@ -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"); diff --git a/discordjs/src/index.mjs b/discordjs/src/index.mjs index 94499e5..c28c65d 100644 --- a/discordjs/src/index.mjs +++ b/discordjs/src/index.mjs @@ -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