Beispiel #1
0
 def assert_cnf(self, sentence, expected):
     result = cnfparser.parse_fo_sentence(sentence)
     for i, cnf in enumerate(expected):
         expected[i] = [{
             symbol.strip()
             for symbol in conjunct.replace("[", "").replace("]", "").split(
                 "|")
         } for conjunct in cnf.split("&") if len(conjunct) != 0]
         expected[i] = set(frozenset(s) for s in expected[i])
     result = set(result)
     self.assertIn(result, expected)
Beispiel #2
0
 def assert_cnf(self, sentence, expected):
     result = cnfparser.parse_fo_sentence(sentence)
     for i, cnf in enumerate(expected):
         expected[i] = [{symbol.strip() for symbol in
                          conjunct.replace("[", "").replace("]", "").split("|")
                         }
                         for conjunct in cnf.split("&")
                         if len(conjunct) != 0
                        ]
         expected[i] = set(frozenset(s) for s in expected[i])
     result = set(result)
     self.assertIn(result, expected)
Beispiel #3
0
 def assert_cnf_equivalence(self, first, second):
     self.assertEqual(cnfparser.parse_fo_sentence(first),
                      cnfparser.parse_fo_sentence(second))
Beispiel #4
0
 def assert_cnf_equivalence(self, first, second):
     self.assertEqual(cnfparser.parse_fo_sentence(first),
                      cnfparser.parse_fo_sentence(second))