Chatterbot

A chatterbot (also chatbot, chatterbox) is a bot program which attempts to maintain a conversation with a person. While it is true that a good understanding of a conversation is required to carry on a meaningful dialog, most chatterbots do not attempt this. Instead they attempt to pick up cue words or phrases from the person which will allow them to use pre-prepared or pre-calculated responses which can move the conversation on in an apparently meaningful way without requiring them to know what they are talking about. One exception to this approach is Jabberwacky which attempts to model the way humans learn new facts and language. The classic early chatterbots are ELIZA and PARRY. More recent programs are Racter and A.L.I.C.E.. A collection of games and functional features accessed via natural language processing allows ELLA to further extend the potential of chatterbots.

WikiChat -- a simple Chatterbot example

In principle a chatterbot can be a very short program. For instance the following QBASIC programwhich should be copied and saved as WikiChat.BASimplements a chatterbot which will learn phrases in any language by repetition in much the same way that a parrot does.
  WikiChat:    DEFINT A-Z    GOSUB Initialise    GOSUB LoadData    GOSUB Converse    GOSUB StoreData    SYSTEM    Initialise:    LET DictionarySize = 1000    DIM Context$(DictionarySize)    DIM Alternatives$(DictionarySize)    LET EmptyRow = 0    LET EndOfResponseCharacter$ = CHR$(180)    LET ContextLength = 6    LET CurrentContext$ = STRING$(ContextLength, EndOfResponseCharacter$)    LET DictionaryFile$ = "WIKICHAT.MEM"    RANDOMIZE TIMER    RETURN    Converse:    DO      LINE INPUT "Human: "; Response$      IF Response$ = "" THEN EXIT DO      LET Response$ = Response$ + EndOfResponseCharacter$      GOSUB Analyse      LET Response$ = ""      GOSUB Generate      PRINT "Computer: "; Response$    LOOP    RETURN    Analyse:    DO WHILE Response$ > ""      LET CurrentCharacter$ = LEFT$(Response$, 1)      LET Response$ = MID$(Response$, 2)      GOSUB InsertCharacter      LET CurrentContext$ = MID$(CurrentContext$, 2) + CurrentCharacter$    LOOP    RETURN    Generate:     DO       GOSUB Lookup       LET CurrentCharacter$ = MID$(Alternatives$(DictionaryIndex), INT(RND * LEN(Alternatives$(DictionaryIndex))) + 1, 1)       IF CurrentCharacter$ = "" THEN         EXIT DO       ELSE         LET CurrentContext$ = MID$(CurrentContext$, 2) + CurrentCharacter$         IF CurrentCharacter$ = EndOfResponseCharacter$ THEN           EXIT DO         ELSE           LET Response$ = Response$ + CurrentCharacter$         END IF       END IF     LOOP     RETURN    InsertCharacter:    GOSUB Lookup    IF INSTR(Alternatives$(DictionaryIndex), CurrentCharacter$) = 0 THEN      LET Alternatives$(DictionaryIndex) = Alternatives$(DictionaryIndex) + CurrentCharacter$    END IF    RETURN    Lookup:    LET Context$(EmptyRow) = CurrentContext$    LET DictionaryIndex = 0    DO WHILE CurrentContext$ <> Context$(DictionaryIndex)      LET DictionaryIndex = DictionaryIndex + 1    LOOP    IF DictionaryIndex = EmptyRow AND DictionaryIndex < DictionarySize THEN      LET Alternatives$(EmptyRow) = ""      LET EmptyRow = DictionaryIndex + 1    END IF    RETURN    LoadData:    OPEN DictionaryFile$ FOR APPEND AS #1    CLOSE #1    OPEN DictionaryFile$ FOR INPUT AS #1    DO WHILE EmptyRow < DictionarySize AND NOT EOF(1)      LINE INPUT #1, Context$(EmptyRow)      LINE INPUT #1, Alternatives$(EmptyRow)      LET EmptyRow = EmptyRow + 1    LOOP    CLOSE #1    RETURN    StoreData:    OPEN DictionaryFile$ FOR OUTPUT AS #1    FOR DictionaryIndex = 0 TO EmptyRow - 1      PRINT #1, Context$(DictionaryIndex)      PRINT #1, Alternatives$(DictionaryIndex)    NEXT    CLOSE #1    RETURN 
Note that to begin with, this chatterbot knows nothing and therefore says nothing. However if one uses simple conversation with it, like a parrot it will begin to reply as it starts to find responses that are appropriate for the immediately preceding sentence.

WikiChat learning sessions

The following sessions show how to teach WikiChat some simple conversation. Note that sessions are started by running the WikiChat program and ended by pressing the return key without giving a response to the computer. They show WikiChat being taught a basic conversational pattern in English.
  (Session 1)   Human: hello there  Computer:  Human: hello  Computer:  Human: how are you  Computer:  Human: fine thanks how are you  Computer: fine thanks how are you  Human: fine thanks  Computer:  Human:    (Session 2)   Human: hello  Computer: how are you  Human: fine thanks how are you  Computer: fine thanks  Human: glad to hear it  Computer:  Human: 
  (Session 3)   Human: hello  Computer: how are you  Human: fine thanks  Computer: glad to hear it  Human: 
The responses will be stored for the next session, so that there is no need to reteach them but it should be noted that while this example chatterbot will create "original" sentences after a little teaching, it has a very limited capacity and works best with short sentences.

See also

External links

 

<< PreviousWord BrowserNext >>
culture of chile
hosea ballou
vmebus
acetylcholine receptor
velvet revolution
jaime luciano balmes
64 bit
henry balnaves
hugh de balsham
computer word
silas deane
charles gravier, comte de vergennes
otto von habsburg
joseph ii, holy roman emperor
offset logarithmic integral
joseph i, holy roman emperor
johann heinrich zedler
round island
ice cube
29th century bc
30th century bc
muggles
carlos santana
condorito
condor
bertie ahern
william styron
gottfried keller
blood, sweat & tears
dendritic cell
live '84
loose nut
process of weeding out
minuteflag
james taylor
annihilate this week
alberto davila
arquebus
pisco
the yeomen of the guard
skid row
bournemouth symphony orchestra
yeomen of the guard
rollins band