Skip to content

Commit ef76eb1

Browse files
committed
Merge branch 'forward_chaining_implementation' of https://github.com/KarimAly12/Python into forward_chaining_implementation
2 parents e717439 + 2fa24df commit ef76eb1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

inference_engine_algorithms/forward_chaining.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def find_symbols_in_kb(knowledge_base: list[str]) -> dict:
2929

3030

3131
def number_of_symbols_in_premise(knowledge_base: list[str]) -> dict:
32-
3332
"""
3433
Count the number of prposiotion symbols in each premise of KB clause.
3534
:param knowledge_base: a list of string of definite clauses
@@ -65,13 +64,13 @@ def get_known_facts(knowledge_base: list[str]) -> list[str]:
6564
def forward_chaining(knowledge_base: list[str], query: str) -> bool:
6665
"""Forward chaining on Knowledge Base(KB) of definite clauses
6766
:param knowledge_base: a list of string of definite clauses
68-
:param query: a single proposition symbol
67+
:param query: a single proposition symbol
6968
:returns: If the query entailed by the KB or not?
70-
>>> input_kb = [ "P => Q", "L & M => P",
69+
>>> input_kb = [ "P => Q", "L & M => P",
7170
... "B&L=> M", "A&P=>L", "A&B=>L", "A", "B" ]
7271
>>> forward_chaining(input_kb, "Q")
7372
True
74-
>>> input_kb = [ "P => Q", "L & M => P",
73+
>>> input_kb = [ "P => Q", "L & M => P",
7574
... "B&L=> M", "A&P=>L", "A&B=>L", "A", "B" ]
7675
>>> forward_chaining(input_kb, "C")
7776
False

0 commit comments

Comments
 (0)