diff --git a/docs/python_Tutorials/tutorial3/InsertNewKnowledge.html b/docs/python_Tutorials/tutorial3/InsertNewKnowledge.html index e5f5e33e..dc852ad4 100644 --- a/docs/python_Tutorials/tutorial3/InsertNewKnowledge.html +++ b/docs/python_Tutorials/tutorial3/InsertNewKnowledge.html @@ -4,10 +4,12 @@
Before starting, here are some imports, an ontology manipulator object, a small function that removes the s of the plural of a word when it is present.
-In the next step, we will define five regexes that correspond to the five types of sentences that our chatbot @@ -177,120 +219,120 @@
We will now write the callback function of a ROS topic that will determine the type of sentence and perform the actions corresponding to each type of sentence.
-Let's break down the code:
-We test here if the sentence sent to the topic corresponds to the first regexp. If so, then the different matches will be put in the match variable. We will do the same for all the regexp.
-If the sentence matches a heritage relationship, we add the inheritance relationship via the member feeder of the ontology manipulator.
Note that we do not directly pass the matches in the parameters but their singular version.
-The third match must contain "not" if the sentence is in its negative form and None if it is @@ -309,13 +351,13 @@
If we got an answer, it will be in the form "type#value".
-Here we try to answer a question such as "what is a kiwi?" You should directly think about using @@ -343,10 +385,10 @@
Finally, we finish with a question of the type "is a kiwi is an animal?". To answer this we could recover all the heritage tree and we look if the concept of @@ -357,21 +399,67 @@
Finally, we can write our main function which creates the ontology manipulator, close the ontology, and subscribes to the topic "feed_and_generalize/in".
-Before moving on, note that we add the concept "bird" before all. This is because to @@ -379,8 +467,8 @@
Now that everything is ready, let's launch our program and in another terminal explain to it that a kiwi is a bird and that it can not fly:
-We can already ask it some questions to evaluate what it knows thanks to this new information:
-It should answer you (in the terminal where the program is launched) that a kiwi is a bird and @@ -408,9 +538,29 @@
We can explain to it that a bird is an animal and ask it again if a kiwi is an animal:
-It is obvious but now our program responds to us that a kiwi is an animal as a kiwi is a bird and a @@ -419,10 +569,31 @@
So let's learn the concept of a penguin who is a bird that can not fly and then ask it again if a bird can fly:
-Surprisingly, our program now responds to the fact that birds can not fly, which is wrong, but @@ -442,23 +613,65 @@
Before continuing, kill Ontologenius and so your program then restarts it and ask it again if the birds can fly.
-It should answer you again no. Yet you have stopped Ontologenius... This is where we understand its long-term memory principle as well as the usefulness of the internal file. When stopping Ontologenius, it stored all its knowledge in the internal file that is reloaded at the restart.
-We will now teach it the principle of a parrot and a dove that are birds capable of flying and ask it again if - the birds can fly.
- -We will now teach it the principle of a parrot and a dove that are birds capable of flying and ask it again if + the birds can fly.
+ +You had to suspect that the 60% condition is no longer true and our program finds itself in @@ -466,26 +679,87 @@
Let's learn five new birds that can all fly to reach the threshold of 60%.
-By asking it one last time if the birds can fly you should finally have a good answer from it and this without ever having explicitly told it.
-As I did in the introduction of this tutorial, simply teach it that a phalarope is a bird and ask it if it can fly:
-Since it has no information about this and because thinking that birds can fly in general, it @@ -494,8 +768,27 @@
However, by asking if a kiwi can fly, you should always have the answer that not that you have explicitly given this knowledge.
-So we have seen here how to add new knowledge during the execution of the program and the impact of @@ -504,8 +797,8 @@
If you wish, you can delete the internal file Ontologenius has created and try again by adding the following line just before closing the ontology in the main function.
-In fact, the generalization mechanism is a reasoning plugin that like all these mechanisms can be diff --git a/docs/python_Tutorials/tutorial3/MakeItProactive.html b/docs/python_Tutorials/tutorial3/MakeItProactive.html index 28a07279..426a9d40 100644 --- a/docs/python_Tutorials/tutorial3/MakeItProactive.html +++ b/docs/python_Tutorials/tutorial3/MakeItProactive.html @@ -146,19 +146,19 @@
Here is the callback function:
And finally, the new ros subscriber to put in the main function:
+And finally, in the main function, we subscribe to the notification topic using the OntologyManipulator:
You can now delete the internal file and learn again to your program that birds can fly diff --git a/docs/python_Tutorials/tutorial3/Presentation.html b/docs/python_Tutorials/tutorial3/Presentation.html index 03579f7d..cb0f4674 100644 --- a/docs/python_Tutorials/tutorial3/Presentation.html +++ b/docs/python_Tutorials/tutorial3/Presentation.html @@ -4,10 +4,12 @@
Before moving on, you can create a new launch file, set the "files" argument with an empty quotation mark to make sure you do not load an - existing ontology, and then set the "intern_file" argument to "$(find ontologenius_tutorial)/birds.owl". + existing ontology, and then set the "intern_file" argument to a file named "birds.owl".
-Let's call this file generalize.launch and put it in our package in the folder launch.
+Let's call this file generalize.xml and put it in our package in the folder launch.
+Let's call this file generalize.py and put it in our package in the folder launch.
+Let's call this file generalize.yaml and put it in our package in the folder launch.
+By specifying an internal file, Ontologenius is allowed to save the ontology it contains in a file when it is stopped and to reload it on its next start. We will see the usefulness of this later.