AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Small XBot project dealing with NLP and spatial data
 
 

Hi,
XBot is my experimental Excel lab (my collection of several classes and functions) to work on various chat bot problems. The goal is to implement lessons learned into my C++ based ‘Walter’. After some consideration and reflection, I’m ready to begin coding again. Here’s the problem I’m working on now.

Project Description

XBot converts human NL input into spatial information that is stored and retrieved.  Retrieval occurs when the human poses a question requiring a response.

Human identifies objects around himself or herself and provides XBot relative information using NL (limited phrasing).  E.g. I’m in front of the television.  The table is to my left.  My front door is behind me on the right.

Human queries XBot about the location of various things.  XBot responds with spatial information.  Example query - Human: Where are you?  XBot: I’m next to the table and in front of the television.

I started coding last night. I constructed a spatial cube (think Rubix cube) with 27 cells (blocks). The human is always in the center.  Items will be placed into the room. If specificity is lacking (e.g. the table is next to me) then it will be flagged as such. XBot will ask questions to identify the location more specifically.

I’m not interested in actual positions or distances, just relative positions.

That’s about it.  Human input will be required to be spelling and grammar correct…no slang for this experiment.

Comments, suggestions, lessons learned from previous experiences are always welcomed!

Regards,
Chuck

 

 
  [ # 1 ]

SHRDLU might give you some insight.

SHRDLU is a program for understanding natural language, written by Terry Winograd at the M.I.T. Artificial Intelligence Laboratory in 1968-70. SHRDLU carried on a simple dialog (via teletype) with a user, about a small world of objects (the BLOCKS world).

http://hci.stanford.edu/~winograd/shrdlu/

 

 
  [ # 2 ]

Merlin,
Thanks for the link. It’s absolutely amazing what could be done with with code 40 years ago. 

Update
I found a couple of more hours last night to work on the problem.  As in any solution, there is a tendency to grow it even bigger with additional capability. I will endeavor to keep it within the intended scope.

One issue I’m working on is this. If the human writes “There is a table.”  Then I can add it to the cube space, but there is no certainty in saying which of the 27 cells it is located.  So, I’m appending a simple string at the end of each item in the cube.  [101] means confidence the X (1) axis position is correct, no confindence in the Y (1) axis, and confident in the Z (1) axis.  The goal is [111].  This is not an optimized solution but it should work in testing the concept.

I could have the bot ask additional questions to figure out where the item is really located.

Regards,
Chuck

 

 
  [ # 3 ]

*Update*
I’ve built and tested the data manipulation half of this project. It does things like adds an item (person, animal, thing), removes an item, tests for an item, and indicates the presence of a particular item. I’m using a 3x3x3 cube with 27 blocks.

I’m working on the Natural Language half of this project now. 

Things have gone slow recently: contractors in and out of house, garden responsibilities, rebuilding an edger and weed-eater, etc.

Overall concept -  I figure the bot will engage in a chat…and as the conversation proceeds, different capabilities will be required such as spatial management, logic, word problems, asking questions, math, emotions, reasoning, etc.  This project is just one of several that will be required to allow a chat bot to interact in more engaging conversations.

Regards,
Chuck

 

 
  [ # 4 ]

*Update*

I’ve worked out the process from beginning to end on paper. Here are the steps.

1.  Human ask a question about item(s) within the spatial cube (relative to the bot).

2.  NL question is converted to ‘pseudo’ language. This involves a lot of substitution and has worked very well with me so far.  Ex: ‘Where are the chairs?’ becomes ‘[A] chairs’

3. Psuedo language is converted to concept code. Using example above this becomes ‘[getposition] chairs’.  This concept code is equivalent to passing a well-defined function to the spatial geometry module.

4. Bot has been programmed with several low-level functions and translates the concept code into a series of functions.

5. Function result is returned and correlates to one or more possible responses. Ex: There is a chair to my left and to my right

I’m not really interested in knowing distances, 3D coordinates, etc.  This module is specifically for conversations where the precise locations of items are not necessary.

Coding follows ‘think time’...which is rare in my household…so the project isn’t coding as fast as I would like. Nonetheless, I’m working on something. =)

Regards,
Chuck

 

 

 
  [ # 5 ]

Sounds good, Chuck. How long before you’ll have some sample i/o? I’m curious to see this bot in action. smile

The neat thing about SHRDLU was that it could recognize that certain objects could be stacked (blocks could be stacked on blocks) and others could not (blocks could not be stacked on cones). Any thoughts on having a way for the bot to learn what objects can be stacked and which cannot? The user can tell the bot via some limited NLP that * cannot be stacked on *, etc. Maybe when someone tries to stack an unstackable object, it ends up next to the object it should have been on top of. Lots of possibilities here. And depending on how this knowledge is stored, it could prove useful for integrating into a generalized chatbot later.

Question: If someone tries to place an object in an upper cell, without anything underneath, will the object always end up in the bottom cell? Are there “physics” rules for the cube?

 

 
  [ # 6 ]

Hi CR,
I must admit that SHRDLU almost set me back in my design. I almost bailed out to start working with 3D objects in space, sizes, stacking, static physics type problems.  I’m very interested in doing that…as it would be fun (and challenging) to build this 3D world. There are some nice physic engines that could be utilized. However I restrained myself to focus on this immediate objective. =)

I’m very interested in the idea that a considerable amount of conversation deals with generalized and often vague positions of items.  In my home for example, someone is always a asking someone else where something is located. So the brain has the ability to deal with ‘vague’ spatial problems. This is demonstrated through our usage of prepositions: in the stove, next to the computer, in front of the couch, under the bed, above the table, etc.  So this project is focused upon that. Converting NL to relative space and back to NL.

Here’s an excerpt from the log file this evening. It shows human input going through two conversions…to pseudo language and then to concept code.

4/10/2011 8:42:02 PM HumanWhere is the dogthe cata horse, and an elephant?
4/10/2011 8:42:02 PM Pseudo[getposition] dog |  cat horse  |  elephant 
4
/10/2011 8:42:02 PM ConceptC1000 dog cat horse elephant 

I’m now coding a concept code of ‘C1000’ as a function trigger….along with the parameters dog, cat, horse, and elephant to the spatial module….which will be used to calculate and create a NL response.  That’s the plan of course.

Regards,
Chuck

 

 

 
  [ # 7 ]
Chuck Bolin - Apr 11, 2011:

I’m very interested in the idea that a considerable amount of conversation deals with generalized and often vague positions of items.  In my home for example, someone is always a asking someone else where something is located. So the brain has the ability to deal with ‘vague’ spatial problems. This is demonstrated through our usage of prepositions: in the stove, next to the computer, in front of the couch, under the bed, above the table, etc.  So this project is focused upon that. Converting NL to relative space and back to NL.

I think you’ve pinpointed a very specific but important issue for chatbots. Because they generally do not have a physical world, understanding logic that relates to physical space is an inherent challenge. Especially so when the terms used to define spatial position are vaguely stated. (Also, it seems to me that which objects you’re discussing might be an important indicator of what a preposition means in a given context.)

Chuck Bolin - Apr 11, 2011:

Here’s an excerpt from the log file this evening. It shows human input going through two conversions…to pseudo language and then to concept code.

4/10/2011 8:42:02 PM HumanWhere is the dogthe cata horse, and an elephant?
4/10/2011 8:42:02 PM Pseudo[getposition] dog |  cat horse  |  elephant 
4
/10/2011 8:42:02 PM ConceptC1000 dog cat horse elephant 

What’s the difference between the tag [getposition] and the tag C1000?

 

 
  [ # 8 ]

CR,

Because they generally do not have a physical world, understanding logic that relates to physical space is an inherent challenge.

I agree. The tendency of course is to build a complex 3D system to manage this problem. I’m hoping to ‘wing it’ with a relative system for most problems.


Looking at the above example, it might not be so clear what about the difference between [getposition] and C1000.  For the moment there isn’t any difference. The [getposition] is the result of NL processing. It results from an iterative process of ‘substitution’.  The concept code is a lookup table.

In the future, there could be multiple pseudo language tags in a single sentence. For example, [getbotdata] [geography] might be in one human query.  [getbotdata][family] could be another one.

They are both requesting data about the chat bot, but the difference is one of focus: where do you live geographically and family details. So conceptually, they could be translated into two different concept codes.

C2020 = [getbotdata] [geography]
C2030 = [getbotdata] [family]

Of course, several variations of pseudo code tags could represent the same concept. The program can process C2020 and C2030 (tree like function calls) to create the correct response.

After I’ve monkeyed around with this process it may become patently clear that I don’t really need this separation…but for now I’m hanging on to it.

Regards,
Chuck

 

 

 
  [ # 9 ]

*Update*

Human: Are there dogs, a cat, an elephant, and birds?

Bot reduces this to a list of: dogs, cat, elephant, birds

I created a class to manage lists (VBA). I can look up these animals and create two lists…one if they are in the relative space, and a list for those that are not. 

Two small obstacles for the moment:

1.I’m working on detecting singular/plural differences.  The ‘space’ may have ‘dog’ so it doesn’t recognize ‘dogs’.
2. There are dozens of ways to respond to this human question depending upon the number of animals in the space.  So I’ working a method to add possible responses to a table (with tags representing words to substitute).

That’s about it. I can say coding such a tiny project reveals quite clearly the complexity of our brain in working with NL.

Regards,
Chuck

 

 
  [ # 10 ]

*Update*

Spent a lot of time this past week working on a more elegant solution on paper. If you’ve coded a bot response system then you know how ugly it can get. =)

I’ve got a few more things to sort out before the bot will generate more natural and varied responses.  I’ve created a few tags embedded in responses (for substitution).

What makes this bot engine a bit different, I think, is that I convert the natural language into a concept.  There may be dozens of way to ask a the same concept. The following concept involves confirming the existing of an item or items in a 3D spatial cube.  I’m hoping the concept perspective may help to make this program more natural language neutral (easily support other languages). However, I’ve a long way to go to prove this bit.

4/23/2011 12:05:49 AM HumanIs there a table?
4/23/2011 12:05:49 AM    Pseudo[confirm] table 
4
/23/2011 12:05:49 AM    ConceptC1020 table
4
/23/2011 12:05:49 AM   BotYesthere is a table.
4/23/2011 12:06:02 AM HumanIs there a lamp and a sofa?
4/23/2011 12:06:02 AM    Pseudo[confirm] lamp   |  sofa 
4
/23/2011 12:06:02 AM    ConceptC1020 lamp sofa
4
/23/2011 12:06:02 AM   BotYesthere is a lamp.
                                                 
Yesthere is a sofa.
4/23/2011 12:06:16 AM HumanIs there an elephant and a horse?
4/23/2011 12:06:16 AM    Pseudo[confirm] elephant   |  horse 
4
/23/2011 12:06:16 AM    ConceptC1020 elephant horse
4
/23/2011 12:06:16 AM   BotYesthere is an elephant.
                                                 
Nothere is no horse

Regards,
Chuck

 

 
  [ # 11 ]

Chuck,
You might need other separators.

Human: Is there a lamp and a sofa?
Pseudo: [confirm] lamp   |  sofa

for example:

Human: Is there a lamp and a sofa?
Pseudo: [confirm] lamp   &  sofa

Human: Is there a lamp or a sofa?
Pseudo: [confirm] lamp   |  sofa

 

 
  [ # 12 ]

A few years ago, some ppl on robitron started a shrdlu recreation thread. My efforts are at: subbot.org/shrdlu.

 

 
  [ # 13 ]

Chuck
I have quite expertise in chatbot construction, and landed here just googling around-

My honest advice is that you are trying to reinvent the wheel (no offense) grin

There is so much done in this fields, you cannot ignere it (and may not have the luck to identify where to look for, so I can help you to trace a roadmap, just google around the terminology I tell you andd you´ll see how much is out there.

So as simple start, I would kindly suggest suggest you to read on Planning Algorithms, check the GraphPlan, its one of the best and easier to implement your problem (as you are creating the chat interface) is just another extremly simple planning problem.  (lots of open source)

If you want to give a bot a real intelligence you must study Natural Language Processing, then master chunking, POS tagging, linguistic parsing, then go to the modelling of relations and information extraction, then decide a known model or create a new and possibly better one, and then incorporate to ot a model of knowledge, and fill some of it into the system (like the objects in the SHLDU room) Add a modal behavior and then the bot may answer.. stop, not answer.. simply know the things / data to express-!! red face

Then you should read a little about Natural Language Generation, (there planning is also used) write (or get some GNU-ware) some system to convert the response-data into meaningful text, and then you will have a micro-intelligent bot, specialized for your defined wolrd. wink

If you want it to reason fairly, you can study and get OWL and N3 reasoners, using Euler algorithm and prolog then the entity may answer some questions about relations inside the world you may have given as knowledge. confused

If you succeed, this bot will also not easily fool a human, that IT thinks.. but will be close to this!

Just then is when the headecks will begin, Exactly when your bot gets fed with dirty text, bad spelled text, missing or changed lettters, and you must also figure out what the heck is the human speaking about! and possibly must guess the language of the input stream of letters (you dont know even if it contains words..) before going to a dictionary.. (uh! what language was it for?) - Welcome to the hell of real NLP bots! cheese

NB: dont even think to try a bot in Spanish or any highly inflected languages! - ist rather complicated to gather all the morphologic rules and get them to work (I did) shut eye

Andres
Check my blog on creating a {entitiy}
http://web.fi.uba.ar/~ahohenda (sorry is in spanish, use google translator to read it out)

 

 
  [ # 14 ]

Hi, Andy, and welcome to chatbots.org.

You may not be aware of it (or maybe you are; I don’t know how many threads you’ve read here, and we have a LOT), but we have a wide range of members here, from simple enthusiasts like myself to folks with “Dr.” in front of their names, the vast majority of which are working on research projects that deal with different aspects of AI. Some of us (myself included) are well aware of the fact that we’re “re-inventing the wheel”, but that’s ok with us, because sometimes, by doing so, we may find better ways to get something done. I’m not trying to put you down, or anything disrespectful like that, and I want you to know that the information you’ve posted is quite helpful, and I’m certain that the community at large will benefit from it. I’ve also read a portion of your blog (you may not know this, but only half of the blog can be translated by Google. The second half remains in Spanish), and found what portions I could read were somewhat engaging (my Spanish skills sadly lack, I’m afraid).

I guess what I’m trying to say here is that more complete consideration would be desirable, prior to offering insights. Ill considered, or poorly considered advice often comes across as patronizing, or even condescending, and can give a bad first impression. It’s my desire that you find this bit of advice helpful, respectful, and that it will be taken in the manner that it was intended. smile

Again, welcome to the forums, and thanks for posting. I pray you will enjoy many more visits, and that you will continue to provide ideas and insights, and also that you find useful information here, as well. smile

 

 
  [ # 15 ]

I just wanted only to give a good advice.
Sorry if it souned harsh.
Its ok to reinvent the wheel, as long as you know it.
And I just want to point out what was underlying beneath the things he was dealing with.
Andy

 

 1 2 > 
1 of 2
 
  login or register to react