
# with open("../data/kinship/test_temp.txt",'w') as fw:
#     with open("../data/kinship/test.txt",'r') as f:
#         for line in f:
#             e1, r, e2 = line.strip().split("\t")
#             fw.writelines(e1 + '\t' + r + '\t' + e2 +'\n')
#             fw.writelines(e2 + '\t' +'!'+r+ '\t' + e1+'\n')

id2relation = {}
relation2id = {}
with open("../data/wn18/relations.dict",'r') as f:
    for line in f:
        rid, relation = line.strip().split("\t")
        id2relation[rid] = relation
        relation2id[relation] = rid
with open("mined_rules.txt", 'w') as fw:
    with open("../mined_rules.txt", 'r') as f:
        for line in f:
            relations = line.strip().split(" ")
            for rel in relations:
                fw.writelines(str(relation2id[rel])+' ')
            fw.writelines(str(1.0)+'\n')
            

# with open("../data/kinship/relations_temp.dict",'w') as fw:
#     id = 0
#     for rid in id2relation:
#         fw.writelines(rid+'\t'+id2relation[rid]+'\n')
#         id += 1
#     for rid in id2relation:
#         fw.writelines(str(id) + '\t' + '!'+id2relation[rid]+'\n')
#         id += 1
        
