13 Replies - 48591 Views - Last Post: 14 July 2008 - 08:01 AM Rate Topic: -----

#1 MaXiMuS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-September 06

Creating a Chatbot

Posted 06 October 2006 - 12:49 PM

I'm creating a simple chatbot based on ELIZA (http://en.wikipedia.org/wiki/ELIZA), with a few advanced features.

I've written down the basic algorithm and structure of the program and have started coding, but here's the biggest hurdle : ELIZA scans each word in your input and compares it against a dictionary. But what I want to do is create a file which looks like this (just as an example) :
<block>
<noun>car</noun>
<verb>stolen</verb>
<response>What? Really?!</response>
<response>That's so sad!</response>
<response>Oh no! How are you gonna get it back?</response>
<verb>broken</verb>
SEVERAL RESPONSES HERE
AND SO ON......
</block>
<block>
ANOTHER NOUN AND THE CORRESPONDING VERBS AND RESPONSES
</block>



Here's what Marvin (my bot) does. He first compares each word with the list of nouns. Then he compares each verb with the verbs INSIDE the block corresponding to the noun. Then he selects a random response and prints it out.

Now I can't find out how to implement this. I don't need the full code (I want to write this myself), just a link to some descent tutorial or a small hint/algorithm.

Also, if you think the format of my file makes things tough, then please suggest some other format. I just chose it because it looks neat and the dictionary will be easy to create, considering that me as well as people working with me are not very experienced.

PS : once I complete this, I'll post the code as well as the complete tutorial here B)

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a Chatbot

#2 MaXiMuS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-September 06

Re: Creating a Chatbot

Posted 06 October 2006 - 01:21 PM

Sorry, forgot this.

For example, when I type "My car has been stolen", internally Marvin compares each word in the string with the nouns. As soon as he finds a match, he compares each word with the list of verbs INSIDE THE NOUN'S BLOCK. Then he chooses a random reply from the pre-defined ones.

The above line might produce the output - "That's so sad!"

Any kind of help will be appreciated. Even if you have the SLIGHTEST hint, please post it here.

Thanx a lot!
Was This Post Helpful? 0
  • +
  • -

#3 MaXiMuS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-September 06

Re: Creating a Chatbot

Posted 07 October 2006 - 12:18 AM

Bump.

Any replies? I need some help!
Was This Post Helpful? 0
  • +
  • -

#4 max302   User is offline

  • Proud supporter of the lulz
  • member icon

Reputation: 3
  • View blog
  • Posts: 1,281
  • Joined: 05-March 06

Re: Creating a Chatbot

Posted 07 October 2006 - 04:19 AM

I'm sorry, but none of our members seen to have any knowledge on Eliza. Don't they have a forum of their own? You might get more help there.
Was This Post Helpful? 0
  • +
  • -

#5 MaXiMuS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-September 06

Re: Creating a Chatbot

Posted 07 October 2006 - 05:07 AM

See the wikipedia link. It's not a programming language or a new concept. It's quite simple to understand.

ELIZA's a chat bot. You can talk to her and she'll give the illusion of intelligence using the following concept -

1. Scan input against a dictionary file to find ONE keyword in the sentence. If there are more than one keywords in the sentence, one of them is chosen based on a ranking system.

2. Print one of the pre defined replies mentioned in the dictionary file.

So, if I type "I love potatoes", ELIZA will scan the string and try to find one keyword. Suppose the keyword "potatoes" is mentioned in it's dictionary file, then it'll just give a pre defined reply to the user. If the keyword is not in the dictionary, it'll just give a vague response such as "what makes you say that?".

There's no official website becuase this was written somewhere in 1968. There are billions of implementations of the same bot, and the "official" version is nowhere to be found.

You can try one of these versions at http://www-ai.ijs.si/eliza/eliza.html

And that's what I'm trying to build, but I can't figure out the file I/O.
Was This Post Helpful? 0
  • +
  • -

#6 DeeViLiSh   User is offline

  • D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 175
  • Joined: 25-July 06

Re: Creating a Chatbot

Posted 08 October 2006 - 02:37 AM

Wow, that is interesting, I'll try making a version of mine and compare ti with yours and perhaps start a team-project.
I like the idea and it was real funny seeing answering.
Was This Post Helpful? 0
  • +
  • -

#7 Euclid27   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-October 06

Re: Creating a Chatbot

Posted 16 October 2006 - 04:44 PM

Check out my website: http://www.ai-search.4t.com, under the link my projects you will find some of the chatterbot programs that i have been working on, i have also made a "java script" version of the "eliza chatterbot", it is available on the website.
Finaly, i have also started a tutorial on how to make chatterbots, this is also available on the same website. Notice that all the source code available on this website are written in C++.

Gonzales.

This post has been edited by Euclid27: 16 October 2006 - 04:45 PM

Was This Post Helpful? 0
  • +
  • -

#8 NyeNye   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 248
  • Joined: 24-September 06

Re: Creating a Chatbot

Posted 16 October 2006 - 06:52 PM

may ask some thing, is that chatbot could be coded in c++ or any other language
Was This Post Helpful? 0
  • +
  • -

#9 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Creating a Chatbot

Posted 16 October 2006 - 06:53 PM

A bot can be coded in any one of a number of languages.
Was This Post Helpful? 0
  • +
  • -

#10 NyeNye   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 248
  • Joined: 24-September 06

Re: Creating a Chatbot

Posted 16 October 2006 - 07:35 PM


ok thankz, but..especially it will be a challenge, i gues?

Was This Post Helpful? 0
  • +
  • -

#11 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Creating a Chatbot

Posted 17 October 2006 - 05:10 AM

A chatbot is not particularly difficult, concept wise. Maximus does a good job of explaining it above. It's really about scanning input and comparing it to a dictionary of keywords, and selecting the appropriate response.

If you are asking whether it is more challenging in one language over another, then the answer is two fold. One one side, the concept is the same, so not extra challenging in that sense. Some languages, however, do have some more advanced features for string manipulation...so I suppose it may be slightly easier to implement in one of those (perl, for example) than assembly.
Was This Post Helpful? 0
  • +
  • -

#12 Teaser   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 14-July 08

Re: Creating a Chatbot

Posted 14 July 2008 - 02:28 AM

A chat bot is very difficult to do accurately and realisticly - most chat bots you can fool or confuse within one to a few sentences thereby making it useless in under 10seconds.

I made a simple chat bot similar to the poster's original idea, which basically used an XML file to link keywords to responses, and it actually worked ok.

In terms of which language to use, I doubt it matters that much, reading and writing to/from an XML file is easy with Java, C++ and C#. Performance is irrelevant for this type of solution because it'll never be realistic enough for performance to be a concern. The chat bot we did was written in Java with a server/client architecture. Java was used mainly because it was quick and dirty. If I were to do it again I'd use a completely different approach and I'd use C++ with a database rather than an XML file.
Was This Post Helpful? 0
  • +
  • -

#13 captainhampton   User is offline

  • Jawsome++;
  • member icon

Reputation: 14
  • View blog
  • Posts: 548
  • Joined: 17-October 07

Re: Creating a Chatbot

Posted 14 July 2008 - 05:52 AM

Codeproject has a whole post dedicated to the Eliza chatbot
http://www.codeproje...ojectEliza.aspx
Was This Post Helpful? 0
  • +
  • -

#14 Cerolobo   User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 450
  • Joined: 05-April 08

Re: Creating a Chatbot

Posted 14 July 2008 - 08:01 AM

View PostTeaser, on 14 Jul, 2008 - 02:28 AM, said:

A chat bot is very difficult to do accurately and realisticly - most chat bots you can fool or confuse within one to a few sentences thereby making it useless in under 10seconds.

...

Please don't bring up old and dead topics, if you don't have a good reason to. This topic is about 2 years old. The original creator of the thread has not be on for well over a year as well.

Here is a hint: If a topic is not on the first 2 or 3 pages in the topic, then it's probably dead.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1