Sign in to follow this  
Nice Coder

Requesting Comments on an algorithm for a bot.

Recommended Posts

Nice Coder    366
Ok, after some thinking (and some talking to washu - He makes good bots, and darkthrone - He also has good ideas), i've come up with the design for the ALPHA 0.5.1 bot. (also known as Dbot). (note: This bot is open design, and source is open to those who ask for it). First object variables. (first mentioned by Darkthrone). FOr eg. you say "The dog is good" It lookes for a the, takes the next word and stores that as a 'singular object'. In this case, it is Dog. The second is the plural object. You get this by refering to many people, and its taken from a, an, these, ect. The girls are good. (Girls, we know that this is the plural version of the word girl, from an internal lookup based on what we've learned. we store the string as 'The girls' tho.) As for which is used where, we take clues from the sentance. For eg. Where are they? (clues are are and they, so we use the plural), or Where is he (is, he, so we use the singular). We just do a replacement. For eg. Where are the group? or Where is andrew?
Main lookup First start by splitting the sentence into phrases. (if theres more theno ne sentence, then pick the last one, after using the it/they lookup on the rest). Then you process each phrase individually, before reconstructing them all at the end. An egsample. Hi, how are you? Split it into two phrases. First word is Hi. You get rid of any non-importain words. (like a, an, the, ect.) Those which are left are scaled. (according to there 'word weight', which is set per word, for eg. how is worth more then is, ect.) Any that don't have a word weight take the defult of 1. You then use 'normal' maximatch (take the weight of every word shared by both the input and the output, weight by the responces value, before comparing it to the 'best' one. pick the best one). Once you have the best responce, you add it. In this egsample the best responce is "Hi". Now we move on to the next phrase. How are you? You is a subect, in this case, we replace you with Dbot. So, how are dbot. Now, we have two possible responces for this: One like we did with the hi, and another using the Semantic net with properties. (properties are things to describe something else that have no links. For eg. a description). The semantic net is self explanitory, so i'm not going to explain it here.
The internal scripting system. Very simply, this is a script, executed using the input, run through a regex. Dead simple really.
Output system. Once you have the output from all the functions, you put them together. Per responce (which is one per phrase) If the responce is a sentence, then join it with an and. (only for two outputs tho. After three, you move onto the next sentence). Otherwise, use a comma. Per sentence of output Make the first letter a capital letter, and make the rest lowercase. Shove one Fullstop/ect. at the end and you've got yourself a sentence! Thats prety much it. Can you see any problems with it? From, Nice coder

Share this post


Link to post
Share on other sites
lucky_monkey    440
Quote:
Original post by Nice Coder
Girls, we know that this is the plural version of the word girl, from an internal lookup based on what we've learned.
How do you learn this in the first place?
Quote:
Original post by Nice Coder
First start by splitting the sentence into phrases. (if theres more theno ne sentence, then pick the last one, after using the it/they lookup on the rest).

Then you process each phrase individually, before reconstructing them all at the end.

An egsample.
Hi, how are you?

Split it into two phrases.
How do you deal with sentences like yesterday, I want to the zoo which is just I went to the zoo yesterday rephrased.
Quote:
Original post by Nice Coder
Those which are left are scaled. (according to there 'word weight', which is set per word, for eg. how is worth more then is, ect.)
Why is 'how' worth more than 'is'? How do word weights get set? How are they adjusted?

Share this post


Link to post
Share on other sites
Metorical    580
It'd be nice to see the data structure or conceptual data structure. Obviously words are related to each other therefore a cleverly designed datastructure will represent this.

As an example you might want to split it in to a tree that subclasifies words.

So Word has subclasses Noun, Adjective, Verb etc...

Adjectives are only applicable to some nouns and verbs so you need some form of cross linkage. Also you have the concept of similar words such e.g. big could be replaced with large or you could be replace with yourname.

You also need to represent the rules of grammar e.g. this word can follow that word but not if this word is before it etc.

Then the most important question is how are you going to train the system? There's no way you could enter a reasonable amount of information by hand. Parsing text files would help build grammatical rules but would tell you nothing about association.

"I have a big car. He has a large boat"

If the system doesn't know that there is a relationship between big and large it can't infer one from these sentences. There are some things you can infer though such as the fact that a boat is a noun.

Share this post


Link to post
Share on other sites
Nice Coder    366
Hmmm.

Well, to answer your questions...

lucky_monkey- Commands are there for a reson.
Also, some of those sentances are hard. i'll think about it for awhile, and try to come up with a better algo.

Metorical - What you are talking abuot is a semantic net. A nifty, although old and well-worn piece of technology.

I really will have to spend some time thinking...

(i seem to be spending quite some time on #Gbot optimising my bots, would either of you care to join me?)

From,
Nice coder

Share this post


Link to post
Share on other sites
ErUs    136
i would love to help out with this if you need any help.

im new to AI and language recognition but i could do sockets and all that :p (c/C++)

i would like to learn how a decent chat bot works and i would like to see a chatbot that could understant the meaning of words so it could be used in games :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this