Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

chatbot python

#install the module:
# pip install chatterbot

# Import "chatbot" from
# chatterbot package.
from chatterbot import ChatBot

# Inorder to train our bot, we have
# to import a trainer package
# "ChatterBotCorpusTrainer"
from chatterbot.trainers import ChatterBotCorpusTrainer


# Give a name to the chatbot “chat bot”
# and assign a trainer component.
chatbot=ChatBot('chat bot')

# Create a new trainer for the chatbot
trainer = ChatterBotCorpusTrainer(chatbot)

# Now let us train our bot with multiple corpus
trainer.train("chatterbot.corpus.english.greetings",
			"chatterbot.corpus.english.conversations" )

response = chatbot.get_response('What is your Number')
print(response)

response = chatbot.get_response('Who are you?')
print(response)
Comment

Create chatbot in Python - Source: NAYCode.com


#****************** Create chatbot in Python - Source: NAYCode.com

from nltk.chat.util import Chat, reflections

pairs = [

    [

        r"my name is (.*)",

        ["Hello %1, How are you today ?",]

    ],

    ]

def MyChatbot_test():

    print("Hi, I am your chatbot.")

    chatbot=Chat(pairs, reflections)

    chatbot.converse()

    if __name__ == '__main__':

        MyChatbot_test()
Comment

AI chatbot in Python - NAYCode.com


#**************** For more tutorial, visit NAYCode.com

from nltk.chat.util import Chat, reflections

pairs = [

    [

        r"my name is (.*)",

        ["Hello %1, How are you today ?",]

    ],

    ]

def MyChatbot_test():

    print("Hi, I am your chatbot.")

    chatbot=Chat(pairs, reflections)

    chatbot.converse()

    if __name__ == '__main__':

        MyChatbot_test()
Comment

PREVIOUS NEXT
Code Example
Python :: how to remove some characters from a string in python 
Python :: serialization in django 
Python :: image resize in python 
Python :: python swap numbers 
Python :: map python 3 
Python :: python to c# converter 
Python :: uninstall python3 from source on centos 7 
Python :: get file parent directory python 
Python :: example of ternary operator in python 
Python :: convert pandas dataframe to numpy dataframe 
Python :: python format strings 
Python :: python regex to find year 
Python :: add option in python script 
Python :: sort dictionary by key 
Python :: python replace n with actual new line 
Python :: how to add subtitle to plot in python 
Python :: dicttoxml python? 
Python :: pyhton image resize 
Python :: is in python 
Python :: how to go up levels in path python 
Python :: how to revert a list python 
Python :: pandas datetime to unix timestamp 
Python :: swap in python 
Python :: making your own range function in python 
Python :: python function docstring 
Python :: how to plot box plot python 
Python :: dataframe of one row 
Python :: create new column with mask pandas 
Python :: python singleton 
Python :: python synonym library 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =