+ 2
Using AI in C++
Hello I want to make an AI chatbot in C++ for my semester project.. Please help me how to do it
5 Respostas
+ 2
Why do you want to use C++?
+ 2
simple way to make a chat bot.
create an dictionaty of keyword and link them with very general answer.
ex. [{
answers: ["yes, its a really fun","so-so"],
keywords:["fun","pleasant","happy","holiday"]
}]
parse the input, search each word in the dictionary, send an answer.
for(let word of input.split(" ")){
let p_ans = answer.filter(a=>a.keywords.includes(word));
let rand1 = Math.floor(Math.random()*p_ans.length);
let rand2 = Math.floor(Math.random()*p_ans[rand1].keywords.length)
console.log(p_ans[rand1].answers[rand2])
}
yes, its not c++ and looks naive but it should roughly tell you the idea
+ 1
A language like Python may have better library support for that.
0
We are restricted to be in domain of c++ in this semester