Using AI in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

5th Feb 2020, 10:54 AM
Mohammad Shaheer 🇵🇰
Mohammad Shaheer 🇵🇰 - avatar
5 Answers
+ 2
Why do you want to use C++?
5th Feb 2020, 11:12 AM
Sonic
Sonic - avatar
+ 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
5th Feb 2020, 11:30 AM
Taste
Taste - avatar
+ 1
A language like Python may have better library support for that.
5th Feb 2020, 11:13 AM
Sonic
Sonic - avatar
0
We are restricted to be in domain of c++ in this semester
5th Feb 2020, 11:23 AM
Mohammad Shaheer 🇵🇰
Mohammad Shaheer 🇵🇰 - avatar