Skip to content

Commit 1171aec

Browse files
committed
Fixed loop in PWN 3.0, closes #83
1 parent 0762a26 commit 1171aec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/load-pwn.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ def ss2of(ss):
475475
(k, v) = line.split('\t')
476476
senslinks[k] = v
477477

478-
478+
# We fix a bug here
479+
# In the original version of PWN 3.0, 02423762-v is its own hypernym.
480+
# The hypernym should be 00612841-v instead.
481+
buggy_synset= wn.synset_from_pos_and_offset('v',2423762)
479482
for ss in wn.all_synsets():
480483

481484
pos = ss.pos()
@@ -484,7 +487,11 @@ def ss2of(ss):
484487
# SSREL
485488
for r in synlinks.keys():
486489
for ss2 in getattr(ss, synlinks[r])():
487-
490+
## fix the loopy bug
491+
if ss == buggy_synset and r == 'hypernym' and ss2 == ss:
492+
ss2 = wn.synset_from_pos_and_offset('v',612841)
493+
sys.stderr.write('Fixed loop for 00612841-v - 02423762-v')
494+
488495
c.execute("""INSERT INTO sslink (ss1_id, ssrel_id, ss2_id, u)
489496
VALUES (?,?,?,?)""",
490497
(ssid[ss2of(ss)], ssrel_id[r], ssid[ss2of(ss2)], u))

0 commit comments

Comments
 (0)