From 5cd7bcb8d96350764188999cc8f1e675ea38f97d Mon Sep 17 00:00:00 2001 From: Zsasz Date: Mon, 17 Aug 2020 04:25:06 +0100 Subject: [PATCH] update --- README.md | 44 ++++++++++++++++++++++++++++++++++++++------ index.md | 44 ++++++++++++++++++++++++++++++++++++++------ test.py | 4 ++-- 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 84ae303..1c40544 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ SemaWal is a semantic network resolver in python - Developpers: Ali AOUF + Developper: Ali AOUF Features | value ---------|--------------------------------------------------------------------------------- @@ -21,9 +21,6 @@ Accounts |[@Twitter](https://twitter.com/40uf411)) SemaWal Is a semantic network resolver developed as a python library. It allows the creation of networks through manual coding or a CSV file. It supports many types of connections between nodes. In addition to extracting knowledge (mainly relations) between two or more nodes in a network, it can find paths between nodes in a given network. - - - ### Features: * Support for multi-relations(connections between nodes). * Support for three types of relations: Strict, regular, extend(inheritance). @@ -60,7 +57,7 @@ pyarabic>=0.6.8 ``` ## Examples -Detailed examples and features in [test.py](test.pt) +Detailed examples and features in [test.py](test.py) * Creating nodes ```python @@ -108,6 +105,12 @@ True [!] Created network MyNet ``` +* Importing a network from a csv file +```python +>>> n = parser.read("link_test.csv") +[!] Created network link_test +``` + * Adding a node to a network ```python >>> myNet.add(nodeA, nodeB, nodeC) @@ -130,4 +133,33 @@ True A | is | B mode: 1 strict: 1 A | extends | C mode: 1 strict: 1 B | is | A mode: 1 strict: 1 -``` \ No newline at end of file +``` + +* Fetching all the relations in a starting from a giving node until reaching a given depth +```python +>>> myNet.search(node=nodeB, depth=3) +B | is | A mode: 1 strict: 1 +A | is | B mode: 1 strict: 1 +A | extends | C mode: 1 strict: 1 +``` + +* Get the path that relats two nodes +```python +>>> myNet.areConnected(nodeA=nodeA, nodeB=nodeB) +B | is | A mode: 1 strict: 1 +A | is | B mode: 1 strict: 1 +[, ] +>>> # that was [nodeA, nodeB] +``` + +* Printing the path that relats two nodes +```python +>>> myNet.drawPath(nodeA=nodeA, nodeB=nodeB) +Printing the path: +A | ['is'] | B +``` + +### On progress features +* A GUI interface +* Nodes properties +* An option to ignore certain relations diff --git a/index.md b/index.md index 84ae303..1c40544 100644 --- a/index.md +++ b/index.md @@ -4,7 +4,7 @@ SemaWal is a semantic network resolver in python - Developpers: Ali AOUF + Developper: Ali AOUF Features | value ---------|--------------------------------------------------------------------------------- @@ -21,9 +21,6 @@ Accounts |[@Twitter](https://twitter.com/40uf411)) SemaWal Is a semantic network resolver developed as a python library. It allows the creation of networks through manual coding or a CSV file. It supports many types of connections between nodes. In addition to extracting knowledge (mainly relations) between two or more nodes in a network, it can find paths between nodes in a given network. - - - ### Features: * Support for multi-relations(connections between nodes). * Support for three types of relations: Strict, regular, extend(inheritance). @@ -60,7 +57,7 @@ pyarabic>=0.6.8 ``` ## Examples -Detailed examples and features in [test.py](test.pt) +Detailed examples and features in [test.py](test.py) * Creating nodes ```python @@ -108,6 +105,12 @@ True [!] Created network MyNet ``` +* Importing a network from a csv file +```python +>>> n = parser.read("link_test.csv") +[!] Created network link_test +``` + * Adding a node to a network ```python >>> myNet.add(nodeA, nodeB, nodeC) @@ -130,4 +133,33 @@ True A | is | B mode: 1 strict: 1 A | extends | C mode: 1 strict: 1 B | is | A mode: 1 strict: 1 -``` \ No newline at end of file +``` + +* Fetching all the relations in a starting from a giving node until reaching a given depth +```python +>>> myNet.search(node=nodeB, depth=3) +B | is | A mode: 1 strict: 1 +A | is | B mode: 1 strict: 1 +A | extends | C mode: 1 strict: 1 +``` + +* Get the path that relats two nodes +```python +>>> myNet.areConnected(nodeA=nodeA, nodeB=nodeB) +B | is | A mode: 1 strict: 1 +A | is | B mode: 1 strict: 1 +[, ] +>>> # that was [nodeA, nodeB] +``` + +* Printing the path that relats two nodes +```python +>>> myNet.drawPath(nodeA=nodeA, nodeB=nodeB) +Printing the path: +A | ['is'] | B +``` + +### On progress features +* A GUI interface +* Nodes properties +* An option to ignore certain relations diff --git a/test.py b/test.py index 570ccd6..ded8805 100755 --- a/test.py +++ b/test.py @@ -7,11 +7,11 @@ nodeB = Node(name="B") nodeC = Node(name="C") nodeA.mutual_link(attribute="is", node=nodeB, mode=1, power=1) -nodeB.extends(nodeC) +nodeA.extends(nodeC) myNet.add(nodeA, nodeB, nodeC) -print(myNet.getNodeskeys()) +n = parser.read("link_test.csv") # n = parser.read("link_test.csv") # n.randomSearch()