Skip to content

Commit

Permalink
Merge pull request #1122 from globalwordnet/issue-1121
Browse files Browse the repository at this point in the history
Remove duplicate ILI links
  • Loading branch information
jmccrae authored Oct 21, 2024
2 parents 36f6272 + fb8f0e2 commit 1be3668
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions scripts/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def main():
errors += 1

instances = set()
ilis = set()

for synset in wn.synsets:
if synset.id[-1:] != synset.part_of_speech.value:
Expand Down Expand Up @@ -374,6 +375,12 @@ def main():
(synset.id, item[1], item[0]))
errors += 1

if synset.ili != "in" and synset.ili in ilis:
print(f"ERROR: ILI {synset.ili} is duplicated")
errors += 1
else:
ilis.add(synset.ili)

for synset in wn.synsets:
for sr in synset.synset_relations:
if sr.rel_type == SynsetRelType.HYPERNYM:
Expand Down
2 changes: 1 addition & 1 deletion scripts/wordnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def change_sense_id(self, sense, new_id):
self.sense2synset[new_id] = sense.synset
self.id2sense[new_id] = sense

def to_xml(self, xml_file, part=True):
def to_xml(self, xml_file, part=False):
xml_file.write("""<?xml version="1.0" encoding="UTF-8"?>\n""")
if part:
xml_file.write(
Expand Down
2 changes: 0 additions & 2 deletions src/yaml/adj.all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,6 @@
- 08215965-n
example:
- a newly activated unit
ili: i216
members:
- activated
partOfSpeech: s
Expand Down Expand Up @@ -53180,7 +53179,6 @@
- a scenic but devious route
- a long and circuitous journey by train and boat
- a roundabout route avoided rush-hour traffic
ili: i4234
members:
- devious
- circuitous
Expand Down
1 change: 0 additions & 1 deletion src/yaml/noun.act.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51679,7 +51679,6 @@
- the mastery of fire was a huge advance in human technology
hypernym:
- 00950950-n
ili: i40396
members:
- technology
partOfSpeech: n
Expand Down
1 change: 0 additions & 1 deletion src/yaml/verb.cognition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5002,7 +5002,6 @@
- Her agent had booked her for several concerts in Tokyo
hypernym:
- 00680201-v
ili: i34688
members:
- book
partOfSpeech: v
Expand Down

0 comments on commit 1be3668

Please sign in to comment.