AI Zone Admin Forum Add your forum

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

How can syllogisms be processed with ChatScript?

Is there any example of implementation of the syllogisms with ChatScript?
How are syllogisms handled by other frameworks?

What is the logic inside ChatScript to solve syllogisms like:
Socrates is a man.
A man is mortal.
Is Socrates a mortal?


  [ # 1 ]

you create 2 appropriate facts and then do an appropriate query…

This is the query kind you want… (untested)

# Similar to up2set but you name a single verb instead of assuming member or is
# given: (sneaker up ~boys_shoes) and (~boys_shoes up ~shoes) and (~shoes up ~clothes) and (~clothes up ~all_items)
# find: (~clothes up ~all_items) given ^query(up2seta sneaker up ‘~all_items 10 )
QUERY: up2seta “1sq 2vt 3ot: queue s: match v2 o3 <2”

so we have ^createfact(Socrates be man) and ^createfact(man be mortal) and then
^query(up2seta Socrates be mortal )


  [ # 2 ]

I am completely new to ChatScript and I struggle to interpret the code a bit cryptic but concise.
I understand that in ChatScript you make use of the concept of sets with the up2set function and that you have simplified things here by introducing the up2seta function which would be more efficient, I think, in this case.
I wonder if the code can be generalized and syllogisms can be done using the same up2seta function even with deeper logical chains, such as:

If it can FLY it goes FAST.
If it is FAST it is UNBEATABLE.



  [ # 3 ]

Your chain of reasoning is not foolproof.  “having” a plane does not prove he flies it and he is unbeatable. There are additional reasoning steps you need. Right now you might prove an airplane is unbeatable. you need to show that having an airplane is the same thing as can fly. 

Doing this will require more than one query. Nominally we dont really care about “can” and “goes”, our facts are
(airplane ability fly)
(fly ability fast)
(fast ability unbeatable)

then logically you want a fact
(pilot own airplane)
and then you want to your question answered by
1. find all things a pilot owns (gets to inherit their abilities). Loop thru them and
2. use up2seta to link airplane ability to unbeatable.


  [ # 4 ]

Of course the logic of a reasoning depends on basic knowledge, but the example given was intended as an example and does not want to prove anything, of course.
Precisely because the result of an argument depends on the data of the database, in this case of the triples (subject, action, object), I ask:
where can you find a large collection of triples so you can make a good reasoner with the support of a lot of knowledge?


  [ # 5 ]

Here are a few large datasets, not exactly triples, but some have this.
Lots of challenges with each source.  And the approach sounds great from 10k feet, but i found that the data is not structured well, so the results from using these sources can be somewhat unpredictable. 
Context is the biggest challenge.  You can use a triple to determine simple factual relationships, such as
Is a dog an animal.  Yes
But beyond this, the triples could provide multiple answers
Is a dog mans best friend. ....  Well, It depends.  Context is important.
I am not saying it cannot be done, but i think it would need a lot of correction and would only be used for specifically designed use cases.
In other words, you would have to write specific logic surrounding the usage of the triple and logic to interpret the results.
And this could not be easily generalized.  Unless it is a very specific factual query.

Here are some large datasets:
DBpedia – a dataset containing extracted data from Wikipedia; it contains about 3.4 million concepts described by 1 billion triples, including abstracts in 11 different languages
FOAF – a dataset describing persons, their properties and relationships
GeoNames – provides RDF descriptions of more than 7,500,000 geographical features worldwide.
UMBEL – a lightweight reference structure of 20,000 subject concept classes and their relationships derived from OpenCyc, which can act as binding classes to external data; also has links to 1.5 million named entities from DBpedia and YAGO
Wikidata – a collaboratively-created linked dataset that acts as central storage for the structured data of its Wikimedia Foundation sister projects
Global Research Identifier Database (GRID) – an international database of 89,506 institutions engaged in academic research, with 14,401 relationships, models two types of relationships: a parent-child relationship that defines a subordinate association, and a related relationship that describes other associations


  [ # 6 ]

I created my Chatbot in order to treat the syllogisms and more generally the inferences, in the manner of an expert system. But in doing that, I found that it’s very complicated to do that in natural language. As Mike Canavan says, you can not do it without knowing the context. Otherwise, we arrive at reasoning so false that they become comical. For example :

I am Johnny; Johnny is my name;
Therefore I am my name…

I have two sons; Each son has three daugters;
Therefore I have six daugters…

John is employed by Boeing; A Boeing is a plane; A plane is a flat surface;
Therefore John is employed by a flat surface…

That’s why I’m convinced (but I could be wrong) that a simple scripting language (AIML, ChatScript or RiveScript, it’s pretty much the same) can never have a really intelligent reasoning. It is not enough to treat words, we must treat the concepts behind words, and these concepts depend on the context. That’s why I created my own interpretation engine for my chatbot. I know, the results are not up to my expectations, but it can be greatly improved, while with a scripting language it is much more difficult (the evidence in this thread).

Note: I answered this thread because it is the last one, but I could have answered identically to this one or that one. Perhaps it would be necessary to gather these discussions or create another thread “How can syllogisms be processed by chatbots”.


  [ # 7 ]

I would not suggest that CS is simple at all. It is actually quite complex.  This is probably the 30th computer language i have learned, and it has everything i can use.  Hard to find a feature that cannot be built, i have not found one yet.  There are a lot of features that you can use to create reasoning and understanding.
But these components would have to be built and the triples would be one way to retrieve and analyze patterns. Which can be used to create new patterns. You can also create apis or directly access an rdm database.  Or hit websites.

On pattern recognition and reasoning, there is an example of this in the esoteric document in the CS wiki.
Not trying to “sell” CS,  but it has the toolset that is needed to create a very viable and vibrant chatbot.
Nothing else currently comes ready, out of the box, fully conversant in the intricacies of the human language.
But you can create it with the right tools.
Cheers and good luck to you on your journey…..


  [ # 8 ]

Thanks to Mike Canavan for the useful links and the message that CS is a good platform on which to develop reasoned chatbots.
Thanks to Danis Robert for criticism of scripting systems and an invitation to investigate other ways as well.
I think that if scripting systems today do not have functions internally, it does not mean that they will not have them forever.
I believe that the evolution of scripting systems like CS will go in the direction of inserting more and more automatic reasoning features into the core of the system.
But this is not an easy task, because otherwise it would have already been done, so I believe that Bruce Wilcox has already thought of something on this topic, only that you can’t do everything at once: one thing at a time.
A lot can already be done today, it seems, and more can be done in the future.
From what I understand so far, CS turns out to be the scripting language that handles chatbot logic better and natively, but it’s really too complicated, really too much, for those who don’t have a programming experience.


  [ # 9 ]

Most of the comments in this forum are about some of the most complex features in CS.
You can build a somewhat robust chatbot by reusing the example from github and never get into these topics or some of the available features.
You do not need to have a programming background to build a decent chatbot.
You can create a strictly deterministic bot by filling out the example from github with your own content. And you dont need a programming background to do this.  Once you get used to the rules, you can write CS quickly.  85 percent of CS is one of 7 patterns, at least in my bots.

But if you really want to extend and leverage CS into something new, you can do it. But it is technical.
Bruce is adding new features all the time, so it will get better. 

There are features built in that really help, for example ~concepts
And his recent extention of concepts.

These are all building blocks. 

There is no concept of someone creating a plug and play API module within CS, for basic or specific functions. Something others can reuse.
I guess the challenge here is that once you publish your code in the wild, which could take months to create, if not years,
it is out there for everyone to use.  Some people are ok with this. Some people are not.
Some people need to eat.  And there is no way to license ans protect any such code.
Maybe you can create a dll or something, with an exposed api, i dont know.

I am not even sure there is a market for this.




  login or register to react