コード例 #1
0
 def test_derivable_with_empty_body_rules(self):
     baba = ExampleFrameworks.cow_framework()
     self.assertTrue(Semantics.derivable(baba, ExampleFrameworks.HOC, []))
     self.assertFalse(
         Semantics.derivable(baba, ExampleFrameworks.not_HOC, []))
     self.assertTrue(
         Semantics.derivable(baba, ExampleFrameworks.not_FM,
                             [ExampleFrameworks.not_FM]))
     self.assertFalse(
         Semantics.derivable(baba, ExampleFrameworks.FM,
                             [ExampleFrameworks.not_FM]))
コード例 #2
0
    def test_valid_cow_framework_probabilities(self):
        baba = ExampleFrameworks.cow_framework()
        self.assertAlmostEqual(
            0.18,
            Semantics.semantic_probability(Semantics.GROUNDED, baba,
                                           [ExampleFrameworks.HP]))

        baba = ExampleFrameworks.conditional_cow_framework()
        self.assertAlmostEqual(
            0.02,
            baba.BN.p_world([
                ExampleFrameworks.cond_JN, ExampleFrameworks.JF,
                ExampleFrameworks.CM
            ]))
        self.assertAlmostEqual(
            0.72,
            Semantics.semantic_probability(Semantics.GROUNDED, baba,
                                           [ExampleFrameworks.HP]))
コード例 #3
0
 def test_defends_with_empty_body_rules(self):
     baba = ExampleFrameworks.cow_framework()
     self.assertFalse(Semantics.defends(baba, [],
                                        ExampleFrameworks.not_HOC))
     self.assertTrue(Semantics.defends(baba, [], ExampleFrameworks.not_FM))