Skip to content

Commit e1354fa

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 50773aa commit e1354fa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

machine_learning/ttentails.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import itertools
1111

12+
1213
def tt_entails(kb: list[str], query: str, symbols: list[str]) -> bool:
1314
"""
1415
Check if the knowledge base entails the query using truth tables.
@@ -29,7 +30,9 @@ def tt_entails(kb: list[str], query: str, symbols: list[str]) -> bool:
2930
model: dict[str, bool] = dict(zip(symbols, values))
3031
# Check if KB is true under this model
3132
# # If query is false in this model, KB does not entail query
32-
if all(eval(sentence, {}, model) for sentence in kb) and not eval(query, {}, model):
33+
if all(eval(sentence, {}, model) for sentence in kb) and not eval(
34+
query, {}, model
35+
):
3336
return False
3437
return True
3538

0 commit comments

Comments
 (0)