Beispiel #1
0
 def test_likely_context_two_by_two(self, make_statement):
     left = FactorGroup(
         [make_statement["murder"], make_statement["large_weight"]])
     right = FactorGroup((make_statement["murder_entity_order"],
                          make_statement["small_weight_bob"]))
     context = next(left.likely_contexts(right))
     assert context.check_match(Entity(name="Alice"), Entity(name="Bob"))
Beispiel #2
0
 def test_likely_context_two_by_two(self, make_entity, watt_factor):
     left = FactorGroup((watt_factor["f9"], watt_factor["f2"]))
     right = FactorGroup(
         (watt_factor["f9_swap_entities"], watt_factor["f9_more_different_entity"])
     )
     context = next(left.likely_contexts(right))
     assert context.check_match(make_entity["motel"], make_entity["trees"])
Beispiel #3
0
 def test_likely_contexts_to_identical_factor(self, make_statement):
     first_group = FactorGroup([make_statement["shooting"]])
     second_group = FactorGroup(
         [make_statement["crime"], make_statement["shooting"]])
     gen = first_group.likely_contexts(second_group)
     context = next(gen)
     assert context.get("<Alice>").name == "Alice"
Beispiel #4
0
 def test_likely_context_different_terms(self, make_opinion_with_holding):
     lotus = make_opinion_with_holding["lotus_majority"]
     oracle = make_opinion_with_holding["oracle_majority"]
     left = [lotus.holdings[2].outputs[0], lotus.holdings[2].inputs[0].to_effect]
     left = FactorGroup(left)
     right = FactorGroup(oracle.holdings[2].outputs[0])
     context = next(left.likely_contexts(right))
     lotus_menu = lotus.holdings[2].generic_terms()[0]
     java_api = oracle.generic_terms()[0]
     assert context.get_factor(lotus_menu).compare_keys(java_api)
Beispiel #5
0
 def test_likely_context_different_terms(self):
     copyright_registered = Statement(
         predicate="$entity registered a copyright covering $work",
         terms=[
             Entity(name="Lotus Development Corporation"),
             Entity(name="the Lotus menu command hierarchy"),
         ],
     )
     copyrightable = Statement(
         predicate="$work was copyrightable",
         terms=Entity(name="the Lotus menu command hierarchy"),
     )
     left = FactorGroup([copyrightable, copyright_registered])
     right = FactorGroup(
         Statement(predicate="$work was copyrightable",
                   terms=Entity(name="the Java API")))
     context = next(left.likely_contexts(right))
     assert (context.get_factor(
         Entity(name="the Lotus menu command hierarchy")).short_string ==
             Entity(name="the Java API").short_string)
Beispiel #6
0
 def test_likely_context_two_factors(self, make_entity, watt_factor):
     left = FactorGroup((watt_factor["f9_swap_entities"], watt_factor["f2"]))
     right = watt_factor["f2"]
     context = next(left.likely_contexts(right))
     assert context.check_match(make_entity["motel"], make_entity["motel"])