nltk.chat package

Submodules

nltk.chat.eliza module

nltk.chat.eliza.demo()[source]
nltk.chat.eliza.eliza_chat()[source]

nltk.chat.iesha module

This chatbot is a tongue-in-cheek take on the average teen anime junky that frequents YahooMessenger or MSNM. All spelling mistakes and flawed grammar are intentional.

nltk.chat.iesha.demo()[source]
nltk.chat.iesha.iesha_chat()[source]

nltk.chat.rude module

nltk.chat.rude.demo()[source]
nltk.chat.rude.rude_chat()[source]

nltk.chat.suntsu module

Tsu bot responds to all queries with a Sun Tsu sayings

Quoted from Sun Tsu’s The Art of War Translated by LIONEL GILES, M.A. 1910 Hosted by the Gutenberg Project http://www.gutenberg.org/

nltk.chat.suntsu.demo()[source]
nltk.chat.suntsu.suntsu_chat()[source]

nltk.chat.util module

class nltk.chat.util.Chat(pairs, reflections={})[source]

Bases: object

converse(quit='quit')[source]
respond(str)[source]

Generate a response to the user input.

Parameters:str (str) – The string to be mapped
Return type:str

nltk.chat.zen module

Zen Chatbot talks in gems of Zen wisdom.

This is a sample conversation with Zen Chatbot: ZC: Welcome, my child. me: Good afternoon. ZC: Ask the question you have come to ask. me: How can I achieve enlightenment? ZC: How do you suppose? me: Through meditation. ZC: Form is emptiness, and emptiness form. me: How can I empty my mind of worldly troubles? ZC: Will an answer to that really help in your search for enlightenment? me: Yes. ZC: It is better to be right than to be certain. me: I seek truth and wisdom. ZC: The search for truth is a long journey. me: Are you sure? ZC: Maybe sure, maybe not sure.

The chatbot structure is based on that of chat.eliza. Thus, it uses a translation table to convert from question to response i.e. “I am” –> “you are”

Of course, since Zen Chatbot does not understand the meaning of any words, responses are very limited. Zen Chatbot will usually answer very vaguely, or respond to a question by asking a different question, in much the same way as Eliza.

nltk.chat.zen.demo()[source]
nltk.chat.zen.zen_chat()[source]

Module contents

A class for simple chatbots. These perform simple pattern matching on sentences typed by users, and respond with automatically generated sentences.

These chatbots may not work using the windows command line or the windows IDLE GUI.

nltk.chat.chatbots()[source]