| 8 | |
| 9 | |
| 10 | class PredictParser: |
| 11 | def __init__(self, schema): |
| 12 | self.predicate_set = schema.type_list |
| 13 | self.role_set = schema.role_list |
| 14 | |
| 15 | def decode(self, gold_list, pred_list, text_list=None, raw_list=None) -> Tuple[List, Counter]: |
| 16 | """ |
| 17 | |
| 18 | :param gold_list: |
| 19 | :param pred_list: |
| 20 | :param text_list: |
| 21 | :param raw_list: |
| 22 | :return: |
| 23 | dict: |
| 24 | pred_event -> [(type1, trigger1), (type2, trigger2), ...] |
| 25 | gold_event -> [(type1, trigger1), (type2, trigger2), ...] |
| 26 | pred_role -> [(type1, role1, argument1), (type2, role2, argument2), ...] |
| 27 | gold_role -> [(type1, role1, argument1), (type2, role2, argument2), ...] |
| 28 | Counter: |
| 29 | """ |
| 30 | pass |
| 31 | |
| 32 | @staticmethod |
| 33 | def count_multi_event_role_in_instance(instance, counter): |
| 34 | if len(instance['gold_event']) != len(set(instance['gold_event'])): |
| 35 | counter.update(['multi-same-event-gold']) |
| 36 | |
| 37 | if len(instance['gold_role']) != len(set(instance['gold_role'])): |
| 38 | counter.update(['multi-same-role-gold']) |
| 39 | |
| 40 | if len(instance['pred_event']) != len(set(instance['pred_event'])): |
| 41 | counter.update(['multi-same-event-pred']) |
| 42 | |
| 43 | if len(instance['pred_role']) != len(set(instance['pred_role'])): |
| 44 | counter.update(['multi-same-role-pred']) |
| 45 | |
| 46 | |
| 47 | class Metric: |
nothing calls this directly
no outgoing calls
no test coverage detected