Skip to content

Commit

Permalink
Reduce some derived units based on simple rules
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jul 6, 2023
1 parent 078fdcd commit 5095f54
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mira/dkg/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def get_unit_terms():
records = query_wikidata(SPARQL)
rv = []
for record in records:
label = record["itemLabel"]["value"].strip()
if not label:
continue

if "per " in label or "square " in label or "cubic " in label:
# skip derived units
continue
xrefs = []
for prefix in [
# "umuc",
Expand All @@ -70,7 +77,7 @@ def get_unit_terms():

rv.append((
record["item"]["value"][len("http://www.wikidata.org/entity/"):],
record["itemLabel"]["value"],
label,
description,
synonyms,
xrefs,
Expand Down

0 comments on commit 5095f54

Please sign in to comment.