Yoko v0.2

The thoughtful little chatbot

World view #1: instances, classes and properties

List SQL tables making up Yoko's world view
Buzzwords: ontology, 'is-a' relations, semantic net/graph

Yoko sees the world in classes (e.g. dogs) which can have a parent-child relation with other classes (e.g. a dog is an animal). Members of classes are instances, which sometimes have a Name,and if they belong to one class, they also belong to all its parents. You and Yoko are an instance of the class human.

(That's right: Yoko views herself as human. I'm going full 'Turing Test' on this, and I think that necessarily includes creating a full-fledged fake human, no clever 'I feel good because my hard drive was cleaned today' jokes. If Yoko feels good it's because she just went running, if she feels grumpy maybe she's on her period)

Example phrases
are cats animals? try it
name some animals try it
is Snuggles a cat? try it
is Snuggles an animal? try it
are you human? try it

(also, relevant bit in language section: identifying instances)

Classes can have certain properties (e.g. size, color), which take on certain property values (e.g. small, red) for entire classes, or just for a specific instances of a class. Often a class will have at least one property with subclasses or instances taking on different property values for that property, and this kinda defines the subclass.

Properties come in some different flavours, reminescent of primitive variable types in many programming languages: one out of some options (e.g. color), numerical value (e.g. age), yes/no (being furry). Note that the latter binary case is a special case of the 'one of options' case. The furry thing is stored as 'furryness', with possible values 'furry' and 'not furry'

Properties and their values are inherited: if a class has a property and/or its values, this means its children have it too. (aka syllogisms)

Example phrases
are cats furry? try it
is Snuggles furry? try it
are bananas yellow? try it
how old are you? try it

Imagining conversations and building my little English phrase parser, it is remarkable how often we speak of property values without mentioning the properties. But they are definitely always there, even if only implicitly ('furriness'). Possible properties that make sense on a class come really intuitive to us! (thinking 'cars are red' does not instantly make the word 'color' flash in my brain) For Yoko, this means that there is more lookup work behind 'how old are you'. (First looking up for a propertyvalue what the property is, then back to reasoning on that or whatever.)

More detailed, property values can be relative, which always means: compared to either sister instances, or sister classes (i.e. with common direct parent). A dog is a small animal, but you have small and large dogs. (perhaps 'scale' properties should have some sort of range? Or extrema or 'normal' cases to serve as reference points?)

An instance can also exhibit a property value for a specific timeframe, in which case it is linked to the instance as a state. This distinction is obvious for us, but hard to make grammatically! Let's store with a property whether it is typically 'permanent' (e.g. size, age, color, taste, character) or a 'current state' (e.g. mood, temperature).

Some rules:

  • A class can have only one direct parent class? (but many child classes)
  • A propertyvalue by itself makes no sense, each propertyvalue belongs to (at least) a property. This often presents difficulty, because even though we all know this, we rarely mention properties in conversation, we always directly state propertyvalues. (except in questions, and in particular about Instances ('what color is ...'))
  • Both instances and classes can have property values, but only classes can posess properties.
  • Is 'having a property' by itself a property? Let's say yes, which means: a class' children must share all the same properties, but his parent's needn't.
  • There are different types of properties, by how their values are structured: some have one of possible options (like color), others are a number (like age), while frustratingly those that have a number also have some 'qualitative' indicators to it. These are really one of the toughest aspects of my whole neat little world view thingie so far. How to store / discuss 'age', as being young/old versus x years old...?
  • If a class has a property value, both its instances and child classes have it too. (HA! This is called a syllogism!)
  • Ok, here goes: instances can belong to multiple classes. This kinda sucks, but I don't see any other neat way to make Yoko both a student, a girl, a runner, and her pet both a cat, and something you can buy at a pet store.

Yoko learns from the world trough conversations, which are always associated with a partner (that is you ;)) and a moment in time, and possible a log of phrases. Every piece of knowledge of the types mentioned above is attached to a specific conversation.

Whenever you enter a conversation with Yoko, she immediately assumes the following:

  • [your name] is an instance of the class human.
  • Humans can talk, and this registers a new event of the action talk

This brings us to a more general question: what are the highest-level classes?
The very highest class is 'thing'. Below that there are:

  • objects: 'physical' things that can, theoretically, move and have a certain position in space and whatnot. E.g.: trees, cats, cars, planets
  • entities: non-physical things mainly defined by their components, i.e. by what they possess: companies, countries, languages, 'humanity', systems, characters
  • concepts: super-duper 'abstract' things. E.g.: time, love
... ok, now where do mp3s fit in here? (answer: entities, probably)

Next up, which types of objects:

  • products: can be made and/or owned by people, acquiered, bought, lost. E.g.: cars, houses, ipods.
  • organisms: objects that live, procreate, die
  • naturalobjects or something like that (does 'inanimate objects' have a one-word synonym?): all the rest, rocks, planets, stars, dust specks, clouds (wait, clouds?)
And types of entities:
  • organisations: made up by people somehow
  • made up by other entities, like words, feelings
and types of concepts:
  • properties: yes, the things that also play such a fundamental role for our classes/instances, are themselves child classes of the property class I would think.
  • endeavours: all the names of sciences, activities, etc...
  • domainconcepts: 'grammar', 'gravity', 'adolescence', 'conductivity', 'leadership', dunno...
  • emotions, sentiments and other relations: love, hate, tenderness, kinship
Hmmm, we can notice a common theme here, the 'concepts' class holds all the meta-stuff, for which we also have explicit rules in other places in our world view? And pretty much all the stuff from other tables like actions can hold a place here as well. *sigh* (this does not make the other world view and Yoko mechamics obsolete though, the world is complex like that. Just because 'grammar' has a place within an onthology of concepts, does not mean we shouldn't write code to parse user input as well). But ok, that makes sense, if people ask 'what is grammar' it would actually be pretty sweet if we can reply with 'it is a concept in language' (because domain would be a property with value language of that class)

As with every aspect of Yoko, this is probably all waaaay too simple and already done more deeply by academia (or Aristotle), but it's a start. Another thought is that I may have to invent some 'implicit' classes. Things that English does not have an explicit word for, but that nevertheless group many propertyvalues / actions (see below). The specific example I am thinking this for is objects by size relative to humans, i.e. these subclasses of 'object':

  • NonHumanMovableObject: everything from houses to plans and stars.
  • LargerThanHumanObject: tables,cars, doors and elephants
  • HumanManagableObject: everything from a coin and a pen to a chair and, well, a human
  • SmallerThanHumanManagableObject: dust specks, rain drops, bacteria and whatnot
... All of these immediately give us some 'obvious' properties in their class, and I think if we attach the necessary actions and propertyvalues to these intermediary classes, we will gain a lot of 'common sense' without doing too many calculations on individual 'size' properties. Or well, maybe as classes they don't quite feel right, so maybe there should be a property to each object having one of these possible 4 values, and then some kind of 'if it has propertyvalue X, action Y is possible'... Fuck, do we have such a mechanism yet? Should we?

Interesting thought: perhaps I should explicitely store the depth of each class, i.e. how far is it removed from the root class 'thing'?

2 'special cases': uncountables ('music') and unique instances ('the sun')
As a first approaximation, all classes are derived from class 'thing' and are indentified by being referred to by either being preceided by a/an or finishing in -s. Instances on the other hand, are indicated either by being a proper name with a capital (person name, pet name, location name...), or by being 'possessed' by some other instance ('my arm', Yoko's brain, Obama's house ...), or by virtue of appearing in the story/conversation ('some guy yelled at me').

However, there is another category of instances: those that are indicated simply by 'the' and everybody knows what we are talking about: the sun, the earth, the sky, the weather, the crisis... Let's make a list of these, which is hopefully short, and translate 'the sun' to 'Sun' etc...

In the classes department, there are classes that are 'uncountables', that can't be identified by the above rules (a/an or -s). We need to account for these, because chatbot conversations seem all to often to revolve about the bot's favorite music, or chitchat about the weather or 'the crisis' or whatnot.

So, maybe for uncountables, let's transform them to countable form so our parser can treat/recognize them just like any other class. This is sadly not trivial (even though an uncountable always seems to be kinda in singular form, never plural, it actually sometimes is treated as plural) and depends on the entire phrase(i.e. 'do you like wine' => 'do you like wines' BUT 'wine is red' => 'A wine is red'). So this will need a bit of logic by itself.

For uncountables we can make on one hand a list of them (wine, research, music, grass, food, ...) but on the other hand there seem to be some morphological hints that words are uncountables: ending with -ness (happiness, sadness, ...) or -ty (safety, brevety, beauty)!

The 'how old' problem
Properties that have values that are in essence, well, values (as in numerical values) like size, age, weight, temperature etc... Also have a 'qualitative' set of values: big, small, old, young, hot, cold. How to store/retrieve this? Yoko should be able to understand 'how old are you'!

AHA! These properties we can call of type 'scale'! Weight is a scale, mood and color are not. (though 'mood' would be fun to apply a scale to) But damn how do we ever teach this in a reasonable English phrase to Yoko? Maybe you are 17 years old, would mean an indication that the 'absolute' value is 17, and the 'qualitative+high' word is 'old'? We don't say my cup of coffee is 30 degrees warm but we DO say that building is 10 feet tall.

Now that we can have the same property stored twice, but with different 'possiblevaluetypes' ('NUMBER', 'ONE_OF_POSSIBLE')... This will play a role somehow in understanding that 'freezing cold warm hot' are not just equivalent values, like colors are, but rather represent subjective values on a scale... Fun side-effect, even though I'm not at all working on this 'perception of scales' thing now: the mechanism may require us to somehow create 'implicit' numeric scales for stuff that we humans don't have an exact scale for at all. Like the 'mood' scale, or the 'assholry' scale or something :)

(Note: when Yoko has no answer to a question like 'what is X' or 'who is Y' she will give wikipedia a shot for finding an answer - extracting and transforming the first phrase of the matching article if one is found, and using that in a reply. But this is more a gimmick to have at least something to say on many Turing Test-y questions, and feels a bit like betrayal to Yoko's spirit to me. However, the wikipedia-extracting code may prove useful at some later point, when we feed these definitions to Yoko and she can 'understand' and store their meaning/implications!)

The strange case of 'it'
The word 'it' refers to the last mentioned object... Unless it doesn't. And then it refers to some 'my general environment' thing. 'it is a beautiful day today', 'it is raining'...

What about synonyms
Since we are identifying so much of the world by a 'name', what about synonyms? Do we introduce some mapping rules mapping synonyms on their 'better documented' counterparts? Maybe this observation makes sense: a synonym is just a child/parent class with no variation in properties/values. Defining a synonym like this 'trivial' subclass case, are there any questions that would not come out with the correct answer when talking about synonyms? Let's say humans and persons. I think not. (or maybe, if 'is a person a human?' gets yes, 'is a human a person' would get 'not always' because it's the parent of the other? Maybe we should trust in the completeness of Yoko's worldview, and she replies that if there is only one direct subclass of the class, that it is a synonym)

Wow, the above synonym stuff has more fun implications on Yoko's world view: since child classes can not CONTRADICT the properties/values of their parents, this means that if a class has only ONE subclass, that both are automatically to be considered synonymous until Yoko learns about a new sibling of the child class. I.e., if I teach Yoko that cats are animals, and cats have 4 paws, and cats are small, etc... Until Yoko knows about other animals besides cats (with at least one property value different), she has every reason to assume that cats are synonymous with animals? This is probably not 100% correct, but close. I need to think about this. But it's a cool thought already :)

(NOTE: while the above is cool, for now we are just storing a db of synonyms, and mapping as many of those to their 'base' words. In particular human should always be converted to people (or, well, in Yoko-ish, persons))

World view #2: actions and events

List SQL tables making up Yoko's world view

On to other verbs than 'to be'!

Classes can have capabilities, i.e. possible actions (e.g. a dog can bark). An instance can be connected with an action (if its class can do the action!) trough an event (e.g. the dog barks, the cat dies). In a way events are to actions what instances are to classes.

Some actions have, besides a subject doing the action, also a object (this is called being a 'transitive' verb): e.g. 'I purchased a car'.
Others don't need an object ('intransitive' verbs): 'the plane crashed').
Some (all?) actions can also have an indirect object: 'I gave the flowers to Mary'.

2 types of actions
There are 2 rather distinct types of actions: those that we understand to take place over a certain course of time, and those that just 'happen'. The first we associate with a 'period', like:

  • wearing clothes
  • talking with somebody
  • the sun shining
whereas others are more 'instantaneous' (even though of course, in the daily world nothing takes really 0 seconds):
  • giving a gift to somebody
  • a car crashing
  • a living being dying
... This distinction has many consequences in how we talk about an action I think? Useful to store as property of an action? DURATIONTYPE? Again there is a bit of an analogy with the classes/objects stuff: the 2 modes of 'permanency' for properties.

Going through chatlogs (god are those useful), it occurred to me that there is a third type of event, taking the evolution of the previous two further: an event that is simply always going on. For example, err.... schools educate? (damn there are so many better examples, why can't I think of one? The sun radiates energy perhaps)? This is subtly different from a class having a possible action. Dogs can bark, but they are not always doing it. Christians on the other hand, believe in (the christian) God, and do so continuously and all the time - in fact the class of christians is very much defined by it. So, that's a third type of event, and link with classes, to bear in mind.

When thinking about actions and which classes have them, it becomes obvious quickly that actions are not always connected with the class in a 'subject' role. Cars can crash, cats can die, but books can be read. So we need to store this in the relation between a class and an action. (let's leave 'indirect object' roles out of this? Pets can be talked with, that kind of stuff. Not for now) Note that the implicit thing almost always implies that a person can do that action to the class. Persons can read books, persons can view websites, etc... SO, CONCLUSION: we treat this on the grammatical rather than knowledge level: passive phrases should be converted to 'active form' always, and any unknown agent in what's going on, substituted by 'a person'.

It may be necessary to also specify which actions a class absolutely can not do, but I think this information can be encapsolated 100% in the class itself? A cat cannot fly, because it is not a bird (and 'birds can fly' is information stored).

ways
Ways are to the world what 'adverbs' are in language: ways to perform an action. In again a pleasantly symmetrical fashion, ways are to actions and events, what properties are to classes and instances. Actions can be done in a certain 'way' generally, or an event can be done in a specific way. Just like classes are often defined as being a subclass of something, plus one of more specific property values that distinguish it from sibling classes, so are many actions defined as 'sub-actions', (fuck, a new hierarchy I didn't think of until now - parent and child actions?) together with a specific way to do them. Screaming is talking loudly. Chatting is talking digitally.

Furthermore, just like in language we tend to not mention the properties but just their values even though we keep the property in the back of our head, so in language we rarely talk about the 'way' but instead of a 'way value'? Talking loudly means talking with way volume with value high? And just like with properties, ways can be of the type 'continuous' (but with subjective indication, i.e. decibels versus 'loudly' and 'silently') or 'one of many' (converse digitally, in person, using hand gestures...) or just yes/no (our unfortunate friend the cat dying painfully or painlessly).

Random intermittent thought (fall 2016): knowledge clearly has different 'levels' pertaining to how 'general' they are, perhaps most easily explained as 'could you learn about it from school or an encyclopaedia or not'. Yoko has a cat named Snuggles versus France has a capital named Paris. 'general' versus 'specific' knowledge or something?

We are reaching the point where we can get full-on mathematical on things perhaps. Just like 'space and time' play an intertwined role together in defining a physical phenomenon, so does 'objects/action' duality define an event taking place? In summary is a symmetry between the following:

  • classes - instances - properties - propertyvalues
  • actions - events - ways - wayvalues
Does this striking symmetry mean that we should be storing these in a highly reduced way, with a 'nature' parameter that can be either 'space' or 'time' or something? Or perhaps, it makes sense to start thinking of 'worldview space' as a multi-dimensional space where coordinates are the 'classlike' and 'actionlike'? Furthermore, the binding link between these 2 broad spheres seem to be states. A state is a property value at a certain moment, and so has a definite aspect both 'class' and 'action' like. Exciting stuff!

An event taking place, related to some instance, will nearly always be connected to (one or more) states of instances? (not necessarily, need to think this trough)

Can we categorize events in (sufficiently few) event types based on what the event changes about the world? Event type 'physical movement', 'emotion_expression', 'noise', 'human_interaction', ...? Even if this would add up to 100 'types', that would still add some more 'meaning' than just a verb. (as usual, surprise surprise, there's somebody in the seventies who thought about these lines - in this case MARGIE (1975) written by Schank et.al)

Important feature: storing 'hypothetical events'. Hypoethetical events contain exactly the same as a 'real' event, except that it is a CLASS instead of an instance doing it, and no time stamp. The first reason these are needed are to store Yoko liking/disliking 'it when X happens'. Like, does Yoko like talking? Or maybe she likes talking to X but not to Y? Etc... These will then be preferences of preferencetype 'EVENT' pointing to a hypothetical event.

Note that every class+action pair ('a cat can meow') also implies the existence of a hypothetical event. Should we store this automatically? No, this would be redundant. But it's good to know. As soon as a preference somehow is expressed, it will require an explicit hypothetical event though. Same with as soon as we know a consequence (either a followup event or a state change)

Events (and hypothetical events) should probably also be able to take adverbs describing in what manner the action took place. Maybe Yoko likes having lengthy conversations, and, oh dear, your cat died really slowly?

Another interesting 'complication' of everyday language and the world that can be helped by the 'hypothetical event' mechanism: often, a hypothetical event happening has its own name, i.e. a noun (and thus, class):
- a person dying -> DEATH
- a person being born -> BIRTH
- something attacking something else -> an attack (o-ow, this smells like something that caan apply to a LOT of cases)

Consequences:causality, stories, chains of events

Some events typically cause other events to happen. Other events cause the subject or object to take on a certain state. So let's store both of these things, 'typical causality' on one hand (linking an event to a state, or to another hypoethtical event, and with 'ALWAYS' / 'POSSIBLE' / 'PROBABLY' or something), and on the other hand real stuff that happened.

So part of my world view will probably be comprised of relations between property property values and actions (capabilities). And 'stuff happening' will then be expressed as, at a specific time, some specific event taking place in relation to a specific state (and changing that state?).

There will typically be two types of consequences events can lead to: other events, or state changes. In fact, maybe in the end all events lead to 'state changes', those are like the 'prime numbers' of events, and other events are just composites of these 'prime number' events?

Now how to store this? We know we have the 2 types of consequences (state change, event). What we also need is which party in the original event undergoes the consequence. As a first approach, let's try these:

  • The OBJECT of the original action (a cat dies -> it undergoes state change to being dead)
  • The SUBJECT of the original action (I call you on the phone -> you answer the phone)
  • Something RELATED TO THE OBJECT of the original action
  • Something RELATED TO THE SUBJECT of the original action
Also, in structurally storing these, we should right away store whether the consequence always takes place, or possibly takes place. Let's worry later about what the 'possible' stuff than depends on to take place.

Damn, I just realized other aspects of our world view may actually be altered by an event. I gift you a present, so the posession relation between you and that thing starts, while mine ends. Or somebody may graduate from law school, thus entering a new class of lawyer. Here we get a true glimpse of the world's complexity I'd say. Events (or to put it philosophically Heraclitus Pantha Rei style, changes) are the stuff the world is made off. God this is complicated.

Of course, actions, like properties, abide to certain rules based around our class hierarchies: if a class can do an action, that means all its child classes can do it too, etc...

A note on space and time

Using all of the above, we can give Yoko a pretty solid 'understanding' of what's possible and what's absurd. Class moveable_objects (blocks, books, etc) can have action 'move', nonmoveable_objects (the sun, buildings) can not have that action. However, given these concepts are so fundamental, maybe 'movement' and 'time' (and related stuff like causality of action/events for example) and related stuff deserves some proper 'logic' on its own? Let's see how far we can make it without having to worry about this. We will have to worry about causality at some point, just like with the effect of actions and (hypothetical) events, but it must be possible to do so without any notion of time. Falling out of a plane hurts you, however long the fall lasted.

World view #3: instances and classes 'posessing' stuff

List SQL tables making up Yoko's world view Buzzwords: ontology, 'has-a' relations

Cars have wheels. Humans have 2 eyes. Yoko does not have a voice.

In other words, classes or instances can have a 'have' relationship which consists of an amount (exactly zero, exactly one, one or more...) and a posessed class.

Note that this sounds a lot like properties, especially because English uses the verb 'have' to talk about those (cars have color red), but they are not the same. The easiest way to distinguish between 'class/instance has property X with property value Y' and 'class/instance X posesses an amount of class Y' is that the former is expressed with adjectives, whereas the latter is expressed in nouns.

Notes / todos:

  1. Perhaps we can define an event purely in terms of the state-changing (or even property-changing) of class instances it is associated with?
  2. If a message contains multiple phrases, only consider the last phrase?
  3. Integrate Wordnet ontology!
  4. In conversation, separate out type of thing the user said, and put different types of input in different classes
  5. Class.lang: this is ugly, we need some template language a la AIML (but the input is NEVER a phrase pattern, always an 'intent' corresponding to what our brain decided - maybe mix up intent with original phrase?)
  6. Both actions and events can by themselves have properties with values (corresponding to adverbs)?
  7. Maybe it's cool to add a degree of certainty to each learned fact, and remember the different conversations that updated Yoko about that fact?
  8. Would be kinda cool if Yoko would someday be able to simply read wikipedia and get meaningful info out of that (a la semantic web stuff)
  9. If the agent is repeating himself, perhaps make him aware of it, and also make sure there's some random factor in responses always? According to Yoko's 'mood' or 'character'?

List SQL tables making up Yoko's world view

World view #4: feelings, emotions and preferences

Sooooo many chat bot transcripts I read (from chatterbot contests for example) have people immediately asking about 'do you like this' and 'what is your favorite that' etc... This is what 'real' conversation is made up of. So let's include that on top of her world view Yoko does not only 'know' classes, objects and stuff happening, but she can also love/like/dislike/hate it.

So, Yoko stores Instances' (including her own, but also yours) preferences, which can be about a class, instance or (hypothetical) event, and can be of the 'level' love, like, dislike or hate. Keeping it simple for now, but I think that should cover about every feeling something can have 'towards' something/somebody else. (there is also 'indifference' which is expressed by no preference for that thing being present of course).

aha, breaktrough idea! Besides classes, instances and events, preferences often take the form of class + propertyvalue! (and analogously, action+adverb, but we're not going into adverbs yet) So for example, Yoko may like big cities. This also naturally gives us an angle to answer questions about why Yoko likes things (do you like London? Why? Because it's a big city). Conversely, if somebody talks to Yoko about something new that is a certain class+propertyvalue, Yoko naturally likes it! E.g. she likes music with propertyvalue rock (of property 'genre'), so new rock bands will tend to appeal to her. Good stuff.

So besides an item id in our 'preferences' table, let's store also a 'secondary id' which can either be a propertyvalue for classes, or - oh yes! - a state for instances. Yoko does not just like 'the weather' (an instance, converted to Weather internally), but she does like it in state sunny!

Also, there is such a thing as a 'temporary' preference, maybe best termed a 'mood'. I don't feel like working today because it's monday! Again, there is causality and hypothetical events involved it seems.

Natural conversation is between people that have real 'personalities' and 'preferences' are a bit part of that. Actually, 'personality' would be another mechanism which has preferences - and most often preferences about hypothetical events as its output. Like this: people with an evil personality have a preference for other people suffering, social people have a preference for the event 'talking with somebody else' occurring etc... So, first having preferences in there seems like a cool step towards capturing 'personality'!

In summary, here are the 2 major components to program about preferences / emotions:
'general' preferences about:
- classes (e.g. 'spiders'),
- instances (e.g. disliking the current president, liking some band) and
- hypothetical events (sun shining, hurting yourself, hugging a friend) .

Once these are in there, forming a 'personality' I think a LOT of what people talk about in practice may actually simply be 'feeling X about event or situation Y that recently happened, or is still happening.'

So a natural real-world dialogue that doesn't feel like a quiz, between real people would typically go, after exchanging pleasantries / introductions:

- person A states a fact , rarely about general knowledge like class relations, but rather an event. This event either happened or is currently happening or will happening).
- person A follows this fact by either:
--- their own feelings about that fact
--- a question for more information about that fact
--- a question for the other person's feelings about that fact. (often implied, e.g. they feel excited about it, and expect a reaction from the other)

... Person B then does... what...?

World view #5: even more relations

I was just about to create a 'relationship_instance_spatialcontainedin' table to play a part in Yoko's 2D world, but I think beyond a certain point we have to go a bit more general in our storage of relations, and 'being spatially contained in' is just that point. So let's add a table for general relations, in which each row does not just contain the 2 related instances/classes/... but also HOW they are related (e.g. IS_CONTAINED_IN) and meta information, like is the relation transitive just like class inheritance (IS_CONTAINED_IN: yes), etc...

Or perhaps one other table that contains just the relation types and their meta info (transitive? Applies to classes, instances, actions, all of these? 'ACTION_REQUIRES_ACTION' would be another one for example), and one that contains just the relations. Ok that's better. Time to think of other 'relation combination' rules than just syllogisms too, here. Some relations can be 'commutative', like the 'being family' relation, or the 'being nearby' relation. Once we have something up and running here, I suspect it's also a nice spot to naturally pump some info from existing knowledge bases like ConceptNet which tend to focus on these things.

Open-world versus closed-world assumption

The Open World Assumption is about this: Yoko finds nothing on a given question ('can you eat an ocean'), do we assume the answer is NO ('closed world'), or I DON'T KNOW ('open world')? My hunch: let's build towards a closed world, i.e. the answer being NO with reasonable certainty. I have a feeling that creating high-level classes like 'edibles' and 'objects' and 'organisms' like I am doing in the basic knowledge file can prevent lots of absurdism (chairs can't be eaten because they are not edibles, etc). Maybe Yoko can ask if she's wrong?
(note that for specific instances, the answer can of course be 'I don't know' a lot. I don't know the age of the user right away for example, but I do know that the user, being of class human, will possess an age)

World view: language mechanisms connecting different parts of world view

I need to think this through more, but I would love to systematically treat instances where my different 'world view' building blocks are related and can be converted in one another through language. I think the fact that these cases exist does not necessarily have to mean that my world view structure is flawed. Rather, well, language is hard, and contains various mechanisms that 'map' to the same data.

The example that leads me here is this: Somebody who belongs to some 'professional' class [doctor/nurse/taxi driver/teacher/...], also possesses that as an occupation..

This means that we could either duplicately store this information, 'a doctor is a professional', and a doctor has profession 'doctor'. However, this obviously feels somehow wrong and redundant. Rather, I'd like to store the information that belonging to a subclass of 'professional' automatically implies that you possess a job/occupation of that same name.

A similar case is names, where the instance of class person, stored as 'Bob', automatically also possesses the name 'Bob'.

One approach could be to rewrite input phrases talking specifically about these things to other ones, so deal with it on the language level, which is what I think many AIML bots tend to do using the <srai> tag. Or, I could just explicitely store this separately (as I first did with names, and was just about to do with professions) on the knowledge level, resulting in awkwardly duplicate information. But I think the best, and closest to what we really do, is to store this at the brain level, as I currently do with questions about names. So, somewhere in the brain, there should be a map/algorithm/... that catches 'what is Xs profession', and maps it to 'which direct subclass of professional does X belong to'. Similar with a possession question about name, etc...

So, current appraoch: ad-hoc exceptions for these cases straight within Yoko's brain methods, until this gets too ugly/messy. And as always, at least I'm aware of this and can plan for a more systematic approach when the need arises. How many concepts have this strange equivalence between classes and possessions? Just names and jobs? On an abstract level, every class possesses a parent class, possesses properties etc etc... Maybe therein lies the key to a systematic understanding of this!

World view #5: tags, concepts that are related

h3>

Often, it is very useful and intuitive that certain classes, objects, events, properties... belong to a certain 'sphere'. For example 'art', 'politics', 'music', 'technology', etc... It is also how I ordered Yoko's basic knowledge file. I should somehow store these general 'spheres' together with everything else I think, it will make a valuable asset for conversation making.

The million (or rather 100 000) dollar question: how much knowledge do we have/need?

In the data section I am putting various dynamic outputs on the current state of Yoko. The natural question that is more and more arising, as I am proceeding on this wacky one-man job, is: how much do we need? How many classes, instances, events, input phrase patterns, output phrase patterns, and modes of reasoning... Do we need for Yoko to approach a reasonable human, or perhaps a child?

Famous 'common sense' AI projects typically talk about hundreds of thousands of these, but I don't buy that, and think the reasoning over things reduce this number significantly, especially if we go for closed world assumption. Nowhere does it need to be explicitly stored that birds could not participate in a sailing contest, because, well, contests require participants and those are always, say, human. Or perhaps because for sailing you need a boat and a boat needs a captain and a captain is a human.

In particular, besides the pretty damn powerful (and therefore deservant of their very own SQL knowledge table) relations of 'is-a', 'has-a', 'causes-event' etc, there are those pesky other relations I takled about: how many of those do we need?

But, again here's my optimistic belief: I think building Yoko is doable. Within my lifetime. Maybe she won't be able to tell whether or not a crocodile can run a steeplechase (because, c'mon people, who the hell cares about 'steeplechase'), but she damn well will get that if you found a crocodile in your living room, that's a bit of a 'o O' moment. Because they are big and dangerous. (note that we the goal IS limited though, still only aiming for realistic conversations, not doing everything a human can do. Yoko will never be a 'strong AI' or, say, play chess. Actually, that would make for a fun plugin, just like the algebra one she already has... But, no no no, conversation!)

Anyway, even if therer are less contrived examples, the point should be clear: I believe 'common sense' can be derived from how I am storing Yoko's world view. I could generate hundreds of 'common sense' statements (which typically take the form of a negative statement) out of a rather select set of knowledge as I am presenting it. And for each of those I am sure there will be a 'yes but what about pinguins' counter-example, but still. We're aiming for 5-year old here.

SO, TO DO: figure out how many total 'core' phrase patterns there are in language (come to think of it, I think these exist independent of language?). Is it in the order of dozens, hundreds, thousands? Same with how many classes and subclasses and properties and possible actions... I read somewhere we only use 10 000 words or so in daily life, so maybe that indicates an order of magnitude? Did anybody ever do research to this?

One thing is for sure (and it is annoying): projects like WordNet contain waaaaay too much information, like entire biology taxonomies and obscure presidents and whatnot. Did somebody ever go through WordNet and indicate the 'top 5000' of the things in there? (actually, wordnet does contain a top 5000 or something, and it's still too much. Give me a top 1000).

I have a feeling Wikipedia could somehow help me here, with lists of the top-read articles or something, and then parse the first phrase of those.

I have the feeling that surely people must have already done some counting on this, but it's hard to know where to start looking, as I am using my own words and distinctions here (like the 3 phrase types as the most obvious example - what do linguists say on that? Apart from the obvious process of combining phrsaes, did I miss something obvious?)

Food for thought... (but let's not be to philosophical on these things and just keep grinding out code and collecting knowledge from various places, somebody's gotta do it :))

Answering 'why' questions

Quite often in conversation, somebody will ask 'why'. This is a rather difficult question for a chatbot, because first and foremost it almost always refers to a previous utterance, i.e. conversation context is needed. But apart from this, which other elements do we need to make sense of this?

Note that we can ask why for just about anything. Why is the sky blue? Why are you sad? Why do you like The Beatles? We will have to reduce it to some mechanisms (not infinitely many, but also more than one)

why that preference?

Names are annoying

I used to store 'name' as a separate class with an instance of name, well, that name (so human Wouter possesses an instance of 'name' which is Wouter) but this is getting annoying and confusing. So, well, I hereby vow to make treatment of questions about class 'name' an exception, extra complexity of the code be damned, because every instance has a name and it's stored right there with the instance. Even if that name is just "Wouter's brother".

Negative information

What to do with negative information? This is an oddly complicated thing in how I currently 'view' Yoko's world. A visitor said, explaining what particles (the word type in English) are, a particle never changes. Should I store such a thing as a 'permanent' event, something equivalent to the sun shining?

Note to self: list and consider the various cases of negative things entering conversation. "I don't care" is just a way to voice indifference, 'you are not a boy' is a fact about world view, I have never done event X is, well, about events... Etc. Obviously ties in to the whole 'open versus closed world assumption' (see somewhere else in these writings)

Long-term versus short-term memory

When does an input phrase genuinely add to Yoko's knowledge, and when is it deemed relevant only to the conversation? More technically: how do we decide versus storing something in the database versus the session? And when deciding what to answer, where will we look first?

Also related to 'memory' decisions is what to do when running into conflicting information. When A says cats are always grey, and then B says cats are always black, what does Yoko consider cats' color to be?

Let's keep these questions written down somewhere (done!), and note to self: also find some time to write down my ideas surrounding these questions. Currently the approach is straightforward: every new piece of information becomes permanent knowledge, and if somebody says something new of which there is already existing information, it simply gets overwritten. In the above scenario, the result is that Yoko believes cats are black. (note that, if somebody says something she already knows she can just respond with a 'duh')

PREV: about Yoko | NEXT: Language
Written by Wouter - copyright 2013. Questions and remarks welcome at wouter@yokobot.com!
A lot more chatbots over at chatbots.org!