コード例 #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)
コード例 #2
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
 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)
コード例 #3
0
ファイル: fologic.py プロジェクト: nikoladimitroff/Adder
 def assert_cnf_equivalence(self, first, second):
     self.assertEqual(cnfparser.parse_fo_sentence(first),
                      cnfparser.parse_fo_sentence(second))
コード例 #4
0
 def assert_cnf_equivalence(self, first, second):
     self.assertEqual(cnfparser.parse_fo_sentence(first),
                      cnfparser.parse_fo_sentence(second))