Closed darvid7 closed 6 years ago
Thanks to indicating the bug. It is the wrong version for debuging. The correct one is:
f = open("data/relation2id.txt","r")
relation2id = {}
id2relation = {}
relation_num = 0
for line in f:
seg = line.strip().split()
relation2id[seg[0]] = int(seg[1])
id2relation[int(seg[1])]=seg[0]
id2relation[int(seg[1])+ relation_num]="~"+seg[0]
relation_num+=1
f.close()
In PRCA.py from what I understand this adds in the reverse of a relation. But I don't think this line ever executes (in python2 or python3) because the contents of the file is already consumed in the loop above it.
https://github.com/thunlp/KB2E/blob/b48738a679232eda1f4e147df6a02009d03d84e8/PTransE/PCRA.py#L30
For example
Outputs
Never printing
"Here"
so the reverse relations prefixed with~
are never added in.