Skip to content

Commit c9e68cc

Browse files
authored
Merge pull request #137 from artnie/jupyter-cells
Update code cell annotator to use python3
2 parents 8b16c36 + c008a09 commit c9e68cc

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

doc/world_reasoner.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from os.path import dirname
2-
31
# World Reasoner
42

53
The world reasoner {py:class}`semantic_digital_twin.reasoner.WorldReasoner` is a class that uses [Ripple Down Rules](https://github.com/AbdelrhmanBassiouny/ripple_down_rules/tree/main)
@@ -22,7 +20,7 @@ world.
2220
For example lets say the reasoner now has rules that enable it find specific types of semantic annotations like the Drawer and the Cabinet.
2321
The way to use the reasoner is like the following example:
2422

25-
```python
23+
```{code-cell} ipython3
2624
from os.path import join, dirname
2725
from semantic_digital_twin.reasoning.world_reasoner import WorldReasoner
2826
from semantic_digital_twin.adapters.urdf import URDFParser
@@ -50,7 +48,7 @@ more attributes of the world.
5048

5149
For example, let's say you want to improve an existing rule that classifies Drawers, you can do that as follows:
5250

53-
```python
51+
```{code-cell} ipython3
5452
from os.path import join, dirname
5553
from semantic_digital_twin.reasoning.world_reasoner import WorldReasoner
5654
from semantic_digital_twin.adapters.urdf import URDFParser
@@ -83,7 +81,7 @@ Open the Template File in Editor from the Ipython Shell.
8381
Now, a template file with some imports and an empty function is openned for you to write your rule inside the body of
8482
the function as shown bellow:
8583

86-
```python
84+
```{code-cell} ipython3
8785
from dataclasses import dataclass, field
8886
from posixpath import dirname
8987
from typing_extensions import Any, Callable, ClassVar, Dict, List, Optional, Type, Union
@@ -103,7 +101,7 @@ def world_semantic_annotations_of_type_drawer(case: World) -> List[Drawer]:
103101

104102
You can write a filter on the current semantic annotations of type Drawer as follows:
105103

106-
```python
104+
```{code-cell} ipython3
107105
from dataclasses import dataclass, field
108106
from posixpath import dirname
109107
from typing_extensions import Any, Callable, ClassVar, Dict, List, Optional, Type, Union
@@ -147,7 +145,7 @@ If you also want to contribute to the semantic digital twin package, then it's b
147145
test file. Since there is already rules for Drawer, there would already be a test method for that. All you need to do is
148146
set the `update_existing_semantic_annotations` to `True` like this:
149147

150-
```python
148+
```{code-cell} ipython3
151149
def test_drawer_semantic_annotation(self):
152150
self.fit_rules_for_a_semantic_annotation_in_apartment(Drawer, scenario=self.test_drawer_semantic_annotation, update_existing_semantic_annotations=True)
153151
```
@@ -162,6 +160,6 @@ specific context, more tests are always welcome :D. Just make sure you set the s
162160
and set the world factory to the method that creates your world (if it doesn't exist create one and put it in the test
163161
file).
164162

165-
In addition you can fit the reasoner on a totaly new concept/attribute of the world instead of `semantic_annotations`, maybe `regions`
163+
In addition you can fit the reasoner on a totally new concept/attribute of the world instead of `semantic_annotations`, maybe `regions`
166164
or `predicates` , ...etc. What's great is that inside your rules you can use the semantic annotations that were classified already by
167165
the semantic annotations rules, and vice verse, you can add semantic annotations rules that use outputs from rules on other attributes as well.

0 commit comments

Comments
 (0)