Skip to content

Commit 449fea1

Browse files
Fix error with leximes
1 parent 0873dbd commit 449fea1

2 files changed

Lines changed: 113 additions & 439 deletions

File tree

src/WikidataTextifier.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,21 @@ def from_raw(cls, claim, value, qualifiers, lazylabel):
259259
qualifiers=[]
260260
)
261261
elif value.get('type') == 'wikibase-entityid':
262-
parsed_value = WikidataEntity(
263-
id=value['value']['id'],
264-
label=lazylabel.create(value['value']['id']),
265-
description=None,
266-
aliases=[],
267-
instanceof=[],
268-
claims=[]
269-
)
262+
id = value['value']['id']
263+
if id.startswith('P') or id.startswith('Q'):
264+
parsed_value = WikidataEntity(
265+
id=id,
266+
label=lazylabel.create(id),
267+
description=None,
268+
aliases=[],
269+
instanceof=[],
270+
claims=[]
271+
)
272+
else:
273+
parsed_value = WikidataText.from_raw(
274+
id, lazylabel
275+
)
276+
270277
elif value.get('type') == 'quantity':
271278
parsed_value = WikidataQuantity.from_raw(
272279
value['value'], lazylabel

0 commit comments

Comments
 (0)