ARTIFICIAL INTELLIGENCE PROJECT

CHATTERBOT

Submitted by: Chunauti duggal(071156) Eshan goel(071160)

Alan Turing published his famous article "Computing Machinery and Intelligence" which proposed what is now called the Turing test as a criterion of intelligence. many simply scan for keywords within the input and pull a reply with the most matching keywords. the aim of such simulation has been to fool the user into thinking that the program's output has been produced by a human (the Turing test). even though the processing involved has been merely superficial. or chat bot) is a computer program designed to simulate an intelligent conversation with one or more human users via auditory or textual methods. Programs playing this role are sometimes referred to as Artificial Conversational Entities. Although many chatbots do appear to interpret human input intelligently when generating their responses. by responding to any input that contains the word 'MOTHER' with 'TELL ME MORE ABOUT YOUR FAMILY'). CHATTERBOT's key method of operation involves the recognition of cue words or phrases in the input. and the output of corresponding pre-prepared or preprogrammed responses which can move the conversation forward in an apparently meaningful way (e. however. from a textual database.on the basis of the conversational content alone . Thus an illusion of understanding is generated. or information acquisition. talk bots or chatterboxes.INTRODUCTION A chatbot (or chatterbot. Traditionally.between the program and a real human. in which case the program is functioning as a type of conversational agent. or the most similar wording pattern. What distinguishes a chatbot from more sophisticated natural language processing systems is the simplicity of the algorithms used. personalised service. CHATTERBOT showed that such an illusion is surprisingly easy to . More recently.g. This criterion depends on the ability of a computer program to impersonate a human in a real-time written conversation with a human judge. BACKROUND In 1950. sufficiently well that the judge is unable to distinguish reliably . chatbot-like methods have been used for practical purposes such as online help.

3. The rules are indexed by keywords. of course. The first program of this sort was developed in 1967 in MIT. Very rarely an entire sentence is matched to give the response. which interact with user in simple English language and can simulate a conversation are known as Chatterbot. because human judges are so ready to give the benefit of the doubt when conversational responses are capable of being interpreted as "intelligent". This file acts as Knowledge Base for the complete system. think on its own. they are emerging as science in themselves. It has a repository or database of facts and rules. which are searched to give the best possible response. HOW DOES IT WORK ? Ninety percent of what chatterbot says is found in the associated Data File.generate. rather than any conveying of genuine information. . Some rules require no keyword. A program like Eliza requires knowledge of three domains: 1.which characterises a program as a chatbot rather than as a serious natural language processing system . Chatterbot can not. The emphasis is typically on vagueness and unclarity.is the production of responses which are sufficiently vague and non-specific that they can be understood as "intelligent" in a wide range of conversational contexts. Artificial Intelligence Expert System Natural Language Processing Even though last two are sub-parts of the first one. Thus the key technique here . 2. WHAT IS A CHATTERBOT? CHATTERBOT is an AI Program that simulates the behavior of a therapist. CHATTERBOT works by matching process. Such programs.

it takes the fact from the static database to respond. 3. Step 5: Any necessary transpositions are done. 2. If no context is found. This keyword defines the Context of the talk. If so. CHATTERBOT> AND WHAT HAPPENS IF YOU WON'T GO TO JAIPUR WITH YOUR WIFE? Here. For the greeting statements. The following strategy is used to respond to a request: Step 1: chatterbot finds out if the user has given any null input. Step 6: To simulate the human conversationalists. then the chatterbot searches for the specific keyword to define the context. Step 2: There are some in built responses that chatterbot can recognize readily. When the user does not type anything and just keeps on pressing Enter. 4. These are the responses for the following cases: 1. When the user repeats himself. . When chatterbot does not understand what the user is talking about. randomly) from the database of available responses. For example. Step 3: If no in-built sentence frame work is found. it deliberately motivates the user to speak about a specific topic. Step 4: A response is chosen (at this time. It finds the presence of any such sentence after fragmenting the user¶s input and remembers the associated keyword.The in-built responses comprise the Static Database of the system. consider the following conversation: SAM> I PLAN TO GO TO JAIPUR TOMORROW WITH MY WIFE. the word My has to be transposed to YOUR. CHATTERBOT simulates Typing and does so slowly with making spelling mistakes and correcting them.

. chatterbot will give one of the following responses: y y HI. from a predefined set of responses. if any. found in that input. in response to 'Hello'. A keyword is separated in the data file (called Dictionary) from the responses by @KWD@ token. tot_resp indicates the total number of responses for a given keyword. CHATTERBOT recognizes certain keywords. resp . nullip indicates whether the user has given any Null input ie. not a response. keyno stores the key number of the corresponding keyword. as it is initialized to 0 in the Constructor. If these keywords are found in the user input. from the above dictionary. for that. one is chosen and displayed. For example. then corresponding to that. Another array keyword is used to store the keyword. We create two classes : y y progstr . If a keyword is found. HOW ARE YOU HELLO DEAR ! Once this thing is clear.CODING PART I am using Turbo C IDE 3.Dat). last_resp is used for the function processing and its use will be clear later on.This is used to store the information about the various responses. we have 2 responses (see chatterbox. resp. tot_resp holds a value of 2. it remains 0. The first data member. This token indicates that the next line that follows is actually a keyword. Now let us come to the second class.0. The character array userip is used to store the line typed by the user. let us now define the Data Structures that we will be using.This is used to store the user's input related information. So. for the keyword Hello. we make int keyfound to 1 else. For example. he is just pressing enter and doing nothing else.

. and before one of the following punctuation marks. void addword(char str[MAX_KWD_LEN]): This is used to add a keyword.. For example. char * getword(): Used to return the keyword for a particular object of class resp. we store this information as CAN I WHAT IF YOU DO NOT * . The first if statement in the for loop is used to make a deliberate typing error to make it appear more human like . In the file chatterbot. So. consider the user input AMIT > CAN I GO TO INDORE TOMORROW ? ELIZA > WHAT IF YOU DO NOT GO TO INDORE TOMORROW ? The underlined portion is not stored in the dictionary. void display_resp(int): This is used to display the response to the user corresponding to a given index number for the responses. rather it is taken from the user input. void quit_display_resp(int): Difference between this function and above function is that it is used in the end when the user is quitting. Char * represents all of the text found AFTER the identified keyword. One character is randomly chosen for typing error. Why last_resp is initialized to -1 will be clear when you look at the function add_resp.The replies are actually stored in replys[MAX_RESP_NO][MAX_RESP_LEN] and the corresponding keyword is stored in the array word.Dat.*. it does not return the prompt to the user. Special cases like New Line and Backspace are separately considered. Description of Functions in Class resp : y y y y y y y Constructor: This is used to initialize the total number of responses to 0.): This is used to add a response corresponding to a given keyword. A special character . void addresp(. int getcount(): This function is used to get a count of how many responses are there for a given keyword. (actually it does more than that !).

YOUR. FRIEND ? ) FUTURE PROSPECTS: Like other AI programs. whenever the user enters his User Name and Password. Intelligent Information Retriever . All the previous talking can be stored in a array of strings. The following are the improvements. CHATTERBOT. I had written a Research Paper on this topic one year ago. A database or a flat file. in place of MY) 3. can be used for the data and talk storage. from the database itself. . will get all the relevant data and previous talks. so that in case of user contradicting himself/herself. The Transposed keyword. GO TO INDORE TOMORROW WITH ) 2.Inception of Artificial Intelligence in Search Engines. y y y y y y Learning by Time or Experience can be Implemented. Text After Transposition Keyword. so as make the retrieval of data and information can be faster. (here. Follow the link to download it if you are interested. so that. which can be made in it. related to the user. Sessions and User-Password Pairs can be established. this program also has immense possibilities of improvement. When we think of transformation. A prospect for the cache Memory can be made. next time. the sentence gets divided in the following 3 sections: 1. Text Before Transposition Word. Standard Search algorithm can be used for the faster or better search of the relevant result or answer. (here. at least. CHATTERBOT can contradict him. as it is. (here.Star (*) asks the program to simply copy whatever is typed after the keyword (here CAN I ) in the user input. even after the completion of one session.

y Various Graphical signs and/or symbols can be incorporated to show emotions. making the conversations more lively and more realistic in nature. .

Sign up to vote on this title
UsefulNot useful