Beispiel #1
0
    def test_2_clusters(self):
        pairs = {
            (_create_entity(0), _create_entity(1)): {
                None: 0.9,
                "coref": 0.1
            },
            (_create_entity(0), _create_entity(2)): {
                None: 0.35,
                "coref": 0.65
            },
            (_create_entity(1), _create_entity(2)): {
                None: 0.4,
                "coref": 0.6
            },
            (_create_entity(1), _create_entity(3)): {
                None: 0.4,
                "coref": 0.6
            },
            (_create_entity(1), _create_entity(0)): {
                None: 0.4,
                "coref": 0.6
            },
        }

        actual_chains = collect_easy_first_mention_chains(pairs)

        expected_chains = [
            _create_chain([0, 2]),
            _create_chain([1, 3]),
        ]
        self.assertEqual(expected_chains, actual_chains)
Beispiel #2
0
    def test_1_pair(self):
        pairs = {
            (_create_entity(0), _create_entity(1)): {
                None: 0.1,
                "coref": 0.9
            },
        }

        actual_chains = collect_easy_first_mention_chains(pairs)

        expected_chains = [_create_chain([0, 1])]
        self.assertEqual(expected_chains, actual_chains)