This article is within the scope of WikiProject Robotics, a collaborative effort to improve the coverage of Robotics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.RoboticsWikipedia:WikiProject RoboticsTemplate:WikiProject RoboticsRobotics
This article is within the scope of WikiProject Linguistics, a collaborative effort to improve the coverage of linguistics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.LinguisticsWikipedia:WikiProject LinguisticsTemplate:WikiProject LinguisticsLinguistics
This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.ComputingWikipedia:WikiProject ComputingTemplate:WikiProject ComputingComputing
This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.Computer scienceWikipedia:WikiProject Computer scienceTemplate:WikiProject Computer scienceComputer science
This article is within the scope of WikiProject Artificial Intelligence, a collaborative effort to improve the coverage of Artificial intelligence on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.Artificial IntelligenceWikipedia:WikiProject Artificial IntelligenceTemplate:WikiProject Artificial IntelligenceArtificial Intelligence
This is the talk page for discussing Chatbot and anything related to its purposes and tasks. This is not a forum for general discussion of the article's subject.
Links to open source bots would be nice... seeking now -- User:DennisDaniels
I've got a very short chatterbot program (<30 lines) which I could add to the article. I wrote it myself in 1984 and as far as I'm concerned it's Open Source. -- Derek Ross | Talk 14:00, 2004 Jun 18 (UTC)
Well, 33 including blank lines -- Derek Ross | Talk 03:35, 22 Jun 2004 (UTC)
SHRDLU was an experiment in natural language understanding, but it hardly qualifies as a chatterbot. The crucial difference is that SHRDLU did know what it was talking about -- or at least "attempted" to. Its purpose, unlike a chatterbot, wasn't just trying to convince human operators that a "real person" was on the other end (except indirectly -- but then any human being qualifies as one, too. :-) -- JRM 12:26, 2004 Sep 1 (UTC)
Agreed. However it's probably worth mentioning it just to point out that it's not a chatbot. -- Derek Ross | Talk 02:57, 2004 Sep 2 (UTC)
That gets a bit too specific, I think -- perhaps a general reference to natural language processing would be better (of which chatterbots are but a specific (and rather whimsical) instance). -- JRM 11:47, 2004 Sep 2 (UTC)
In principle a chatterbot can be a very short program. For instance the following 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) 'The character sequences that WikiChat has already seen
DIM Alternatives$(DictionarySize) 'The characters that WikiChat may print after recognising a sequence.
LET EmptyRow = 0
LET EndOfResponseCharacter$ = CHR$(180)
LET ContextLength = 6 'A bigger value makes WikiChat more grammatical but slower learning.
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 MemoriseHumanResponse
LET Response$ = ""
GOSUB GenerateComputerResponse
PRINT "Computer: "; Response$
LOOP
RETURN
MemoriseHumanResponse:
DO WHILE Response$ > ""
LET CurrentCharacter$ = LEFT$(Response$, 1)
LET Response$ = MID$(Response$, 2)
GOSUB InsertCharacter
LET CurrentContext$ = MID$(CurrentContext$, 2) + CurrentCharacter$
LOOP
RETURN
GenerateComputerResponse:
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. — Preceding unsigned comment added by Derek Ross (talk • contribs) 16:12, 20 November 2005 (UTC)[reply]