# # The test file also displays the instantiated list of input statements instantiated with # the each of the bindings that were found print "\033[0;32m\n=================== Loading in the data ===================\x1b[0m" facts, rules = read.read_tokenize("asserts.txt") retracts, retract_rules = read.read_tokenize("retracts.txt") asks, ask_rules = read.read_tokenize("asks.txt") print "\033[0;32m\n=================== Setting up the Knowledge Base ===================\x1b[0m" ins = logic.kb() print print "KB: # of facts " + str(len(global_list.KB)) +" # of rules "+ str(len(global_list.RB)) for kb in global_list.KB: print "fact: " + kb.pretty() for rb in global_list.RB: print rb.pretty() print print "\033[0;32m\n=================== Testing KB_Assert ===================\x1b[0m" for rule in rules: logic.assert_rule(logic.Rule(rule[0], rule[1])) for fact in facts:
# of the various bindings that have to hold for those statements to be true in the data. # # The test file also displays the instantiated list of input statements instantiated with # the each of the bindings that were found print "\033[0;32m\n=================== Loading in the data ===================\x1b[0m" facts, rules = read.read_tokenize("asserts.txt") retracts, retract_rules = read.read_tokenize("retracts.txt") asks, ask_rules = read.read_tokenize("asks.txt") print "\033[0;32m\n=================== Setting up the Knowledge Base ===================\x1b[0m" kb = logic.kb() print print kb print "\033[0;32m\n=================== Testing KB_Assert ===================\x1b[0m" for rule in rules: logic.KB_assert(kb, rule) for fact in facts: logic.KB_assert(kb, fact) for fact in kb.facts: print fact
# # The test file also displays the instantiated list of input statements instantiated with # the each of the bindings that were found print "\033[0;32m\n=================== Loading in the data ===================\x1b[0m" facts, rules = read.read_tokenize("asserts.txt") retracts, retract_rules = read.read_tokenize("retracts.txt") asks, ask_rules = read.read_tokenize("asks.txt") print "\033[0;32m\n=================== Setting up the Knowledge Base ===================\x1b[0m" kb = logic.kb() # print kb print "\033[0;32m\n=================== Testing KB_Assert ===================\x1b[0m" for rule in rules: kb.kb_assert(rule) for fact in facts: kb.kb_assert(fact) for fact in kb.facts: print fact print "\033[0;32m\n=================== Testing KB_ask ===================\x1b[0m"