From cfa88c9574af736df514250c689f8f950180e5fb Mon Sep 17 00:00:00 2001 From: Chipe1 Date: Fri, 25 Aug 2017 18:22:49 +0530 Subject: [PATCH] Changed FOIL class name --- knowledge.py | 2 +- logic.py | 4 ++-- tests/test_knowledge.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/knowledge.py b/knowledge.py index 6fe09acd2..c591a0fea 100644 --- a/knowledge.py +++ b/knowledge.py @@ -234,7 +234,7 @@ def consistent_det(A, E): # ______________________________________________________________________________ -class FOIL_container(FolKB): +class FOILKB(FolKB): """Holds the kb and other necessary elements required by FOIL""" def __init__(self, clauses=[]): diff --git a/logic.py b/logic.py index 5810e633f..d5702a412 100644 --- a/logic.py +++ b/logic.py @@ -222,7 +222,7 @@ def prop_symbols(x): elif is_prop_symbol(x.op): return {x} else: - return {symbol for arg in x.args for symbol in prop_symbols(arg)} + return set().union(*map(prop_symbols, x.args)) def constant_symbols(x): @@ -232,7 +232,7 @@ def constant_symbols(x): elif is_prop_symbol(x.op) and not x.args: return {x} else: - return {symbol for arg in x.args for symbol in constant_symbols(arg)} + return set().union(*map(constant_symbols, x.args)) def predicate_symbols(x): diff --git a/tests/test_knowledge.py b/tests/test_knowledge.py index 89fe479a0..ad564ea82 100644 --- a/tests/test_knowledge.py +++ b/tests/test_knowledge.py @@ -246,7 +246,7 @@ def r_example(Alt, Bar, Fri, Hun, Pat, Price, Rain, Res, Type, Est, GOAL): vv v C F """ -test_network = FOIL_container([expr("Conn(A, B)"), +test_network = FOILKB([expr("Conn(A, B)"), expr("Conn(A ,D)"), expr("Conn(B, C)"), expr("Conn(D, C)"), @@ -257,7 +257,7 @@ def r_example(Alt, Bar, Fri, Hun, Pat, Price, Rain, Res, Type, Est, GOAL): expr("Conn(H, G)"), expr("Conn(H, I)")]) -small_family = FOIL_container([expr("Mother(Anne, Peter)"), +small_family = FOILKB([expr("Mother(Anne, Peter)"), expr("Mother(Anne, Zara)"), expr("Mother(Sarah, Beatrice)"), expr("Mother(Sarah, Eugenie)"),