Chatbot ML che utilizza Python.
Un Chatbot è un'applicazione che interagisce con gli utenti come un essere umano. I chatbot vengono in genere utilizzati per risolvere le domande più comuni che un'azienda riceve quotidianamente dai propri clienti. In questo articolo, ti guiderò attraverso il processo per creare un chatbot di base utilizzando Python. Puoi improvvisare lo stesso per formare chatbot più complessi.
Cos'è un chatbot?
Un chatbot è un'applicazione AI che imita le conversazioni umane. È ampiamente utilizzato dalle aziende per risolvere i problemi più comuni che ricevono quotidianamente dai clienti. Quindi, mentre crei un chatbot per qualsiasi azienda, dovresti sapere di cosa si occupa quell'azienda e quali problemi incontrano quotidianamente i suoi clienti. Nella sezione seguente, ti illustrerò come creare un chatbot utilizzando Python.
Chatbot AI con Python
Spero che ora tu abbia capito cosa sono i chatbot e perché così tante aziende li utilizzano per risolvere i problemi più comuni dei propri clienti. Ora vediamo come creare un chatbot con Python. Qui userò la libreria NLTK in Python , che è una delle migliori librerie Python per qualsiasi attività di elaborazione del linguaggio naturale:
Ora creerò un elenco di domande e le relative risposte per il chatbot:
#Chatbot and my_reflections are list of patterns and responses.
my_reflections= {
"you": "I",
"your": "my",
"you're": "I'm",
"I": "you",
"my": "your",
"I'm": "you're"
}
chatbot = [
[
r"(.*)my name is (.*)",
["Hello %2, How are you today ?",]
],
[
r"(.*)help(.*) ",
["I can help you ",]
],
[
r"(.*) your name ?",
["My name is AI BOT, but you can just call me robot and I'm a chatbot .",]
],
[
r"how are you (.*) ?",
["I'm doing very well", "i am great !"]
],
[
r"sorry (.*)",
["Its alright","Its OK, never mind that",]
],
[
r"i'm (.*) (good|well|okay|ok)",
["Nice to hear that","Alright, great !",]
],
[
r"(hi|hey|hello|hola|holla)(.*)",
["Hello", "Hey there",]
],
[
r"what (.*) want ?",
["Make me an offer I can't refuse",]
],
[
r"(.*)created(.*)",
["Akhil Makol created me using Python's NLTK library ","top secret ;)",]
],
[
r"(.*) (location|city) ?",
['Haryana, India',]
],
[
r"(.*)raining in (.*)",
["No rain in the past 4 days here in %2","In %2 there is a 50% chance of rain",]
],
[
r"how (.*) health (.*)",
["Health is very important, but I am a computer, so I don't need to worry about my health ",]
],
[
r"(.*)(sports|game|sport)(.*)",
["I'm a very big fan of Cricket",]
],
[
r"who (.*) (Cricketer|Batsman)?",
["Virat Kohli"]
],
[
r"quit",
["Bye for now. See you soon :) ","It was nice talking to you. See you soon :)"]
],
[
r"(.*)",
['That is nice to hear']
],
]
#default message at the start of chat
print("Hi, I'm AI BOT and I like to chat\nPlease type lowercase English language to start a conversation. Type quit to leave ")
#Create Chat Bot
chat = Chat(chatbot, my_reflections)
#Start conversation
chat.converse()
Riepilogo
I chatbot sono applicazioni molto utili per ogni azienda, soprattutto se un'azienda fornisce qualsiasi tipo di servizio. Aiuta un'organizzazione risolvendo le domande più comuni dei clienti. Spero ti sia piaciuto questo articolo su come creare un chatbot usando Python. Sentiti libero di porre le tue preziose domande nella sezione commenti qui sotto.
GitHub: ML-Chatbot-using-Python/chatbot.py in main · akhilmakol/ML-Chatbot-using-Python (github.com)

![Che cos'è un elenco collegato, comunque? [Parte 1]](https://post.nghiatu.com/assets/images/m/max/724/1*Xokk6XOjWyIGCBujkJsCzQ.jpeg)



































