if you want chatbots to work like google or siri you have to use some Api's
else
python
Chat bot with python, you have do it with flutter or tkinter for making a frontend, and for the rest you can take input with text or speech, I used a speech Variant without any front end
importosimporttimeimportplaysoundimportspeech_recognitionassrfromgttsimportgTTSdefspeak(text):tts=gTTS(text=text,lang="en")filename="voice.mp3"tts.save(filename)playsound.playsound(filename)defget_audio():r=sr.Recognizer()withsr.Microphone()assource:audio=r.listen(source)said=""try:said=r.recognize_google(audio)print(said)exceptExceptionase:print("Exception: "+str(e))returnsaidtext=get_audio()if"hello"intext:speak("hello, hey there wassup")if"what is my name"intext:speak("your name is warlord")if"what is your name"intext:speak("my name is Luciale")if"good morning"intext:speak("a very good morning to you")if"good night"intext:speak("good night, scary dreams")
Like this you have to include for every bit of words.
But for text input
Chat=input('your text here');If"hi"inChat:Print('hello how are you');# you can keep continue like this
There might be better options than this, I am just giving this as a reference.
javascript
Here you have to get inputs from the html forms and can write the logic
constbtn=document.querySelector('.talk');constcontent=document.querySelector('.content');constbody=document.querySelector('.back');constser=document.querySelector('.gsearch');constSpeechRecognition=window.SpeechRecognition||window.webkitSpeechRecognition;constrecognition=newSpeechRecognition();recognition.onstart=function(){console.log('voice is activated');};recognition.onresult=function(event){constcurrent=event.resultIndex;consttranscript=event.results[current][0].transcript;content.textContent=transcript;readOutLoud(transcript)};btn.addEventListener('click',()=>{recognition.start();});functionreadOutLoud(message){constspeech=newSpeechSynthesisUtterance();speech.text=message;if(message.includes('hello')){constfinalText='Howdy, how can i help you?';speech.text=finalText;}elseif(message.includes('my name')){speech.text='your name is Warlord';}elseif(message.includes('dark mode')){speech.text='switching to dark mode';body.style.backgroundColor='black';body.style.color='green';}elseif(message.includes('light mode')){speech.text='switching to light mode';body.style.backgroundColor='white';body.style.color='blue';}elseif(message.includes('Google search')){ser.style.display='block';}speech.volume=1;speech.rate=1;speech.pitch=1;window.speechSynthesis.speak(speech)}
if you want chatbots to work like google or siri you have to use some Api's
else
python
Chat bot with python, you have do it with flutter or tkinter for making a frontend, and for the rest you can take input with text or speech, I used a speech Variant without any front end
Like this you have to include for every bit of words.
But for text input
There might be better options than this, I am just giving this as a reference.
javascript
Here you have to get inputs from the html forms and can write the logic
Wow thanks 👍💖