while current_node.child_nodes.len() != 0 {
// We need to choose a random child based on weights
let weighted = WeightedIndex::new(current_node.child_nodes.iter().map(|(_, node)| {
- (node.child_count
+ node.child_count
/ (node
.child_nodes
.iter()
.map(|(_, b)| b.child_count)
.sum::<u64>()
+ 1)
- + 1)
+ + 1
}))
.expect("distribution creation should be valid");
let response = await completeWord(cutWord(message.cleanContent));
// Ignore if there is no completion
- if ((response || response === "") && Math.random() > 0.6) {
+ if ((response || response === "") && Math.random() > 0.8) {
message.reply(response);
}
} catch (e) {