MCPcopy Create free account
hub / github.com/LHRLAB/ChatKBQA / construct_common_data

Function construct_common_data

data_process.py:692–711  ·  view source on GitHub ↗
(
    filtered_relations_path,
    domain_range_label_map_path,
    output_relation_rich_map_path,
    output_rich_relation_map_path,
    output_filtered_rich_relation_path,
)

Source from the content-addressed store, hash-verified

690 return res
691
692def construct_common_data(
693 filtered_relations_path,
694 domain_range_label_map_path,
695 output_relation_rich_map_path,
696 output_rich_relation_map_path,
697 output_filtered_rich_relation_path,
698):
699 filtered_relations = load_json(filtered_relations_path)
700 domain_range_label_map = load_json(domain_range_label_map_path)
701 relation_rich_map = dict()
702 rich_relation_map = defaultdict(list)
703 filtered_rich_relations = []
704 for rel in filtered_relations:
705 richRelation = serialize_rich_relation(rel, domain_range_label_map).replace('\n', '')
706 relation_rich_map[rel] = richRelation
707 rich_relation_map[richRelation].append(rel)
708 filtered_rich_relations.append(richRelation)
709 dump_json(relation_rich_map, output_relation_rich_map_path)
710 dump_json(rich_relation_map, output_rich_relation_map_path)
711 dump_json(filtered_rich_relations, output_filtered_rich_relation_path)
712
713
714if __name__=='__main__':

Callers

nothing calls this directly

Calls 3

load_jsonFunction · 0.90
dump_jsonFunction · 0.90
serialize_rich_relationFunction · 0.85

Tested by

no test coverage detected