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.
| Contents |
WikiChat -- a simple Chatterbot example
In principle a chatterbot can be a very short program. For instance the following QBASIC program—which should be copied and saved as WikiChat.BAS—implements 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
- Turing test
- Loebner prize
- ChatterBox challenge
- Chatbot competitions
- Chatbot algorithms
- Natachata
- Markov chain
External links
- The A.L.I.C.E. Artificial Intelligence Foundation (http://www.alicebot.org/)
- Archbot (http://home.bellsouth.net/p/PWP-archbot)
- EllaZ Systems (http://www.ellaz.com)
- eBOT :: ExtraBOT (http://extrabot.net/)
- Jabberwock (http://www.abenteuermedien.de/jabberwock)
- Jabberwacky (http://www.jabberwacky.com)
- Mathetes (http://rome.purepistos.net/mathetes)
- MegaHAL (http://megahal.sourceforge.net/)
- Talk to William Shakespeare (http://www.shakespearebot.com)
- The Turing Hub / Cybermecha Studios (http://www.turinghub.com/)
- A.I. Alex (http://ai-alex.propercomfy.co.uk)
- Matrixbot (http://www.geocities.com/nice_coder_2004)
- Commercial bots
- AI Bush (http://www.aibush.com/)
- Conversive Inc. (http://www.conversive.com/)
- Novomind (http://www.novomind.com/)
- Synthetix Ltd (http://www.synthetix.com/)
- Kiwilogic (http://www.kiwilogic.com/)
- Zabaware (http://zabaware.com/)
- Create your own bots
- Lots-A-Bots™ (http://www.lots-a-bots.com)
- Pandorabots (http://www.pandorabots.com/)
- The Personality Forge (http://www.personalityforge.com/)
- Self learning bots
- Dante and Leo (http://www.dantebot.com/)
- Prelude (http://novalis78.topcities.com/)de:Chatterbot
