New function to get English label for entity

This commit is contained in:
Edward Betts 2019-10-09 16:25:17 +01:00
parent 6a6b5ad373
commit f322a6f47f

View file

@ -9,3 +9,7 @@ def get_entity_label(entity):
label_values = {l['value'] for l in entity['labels'].values()} label_values = {l['value'] for l in entity['labels'].values()}
if len(label_values) == 1: if len(label_values) == 1:
return list(label_values)[0] return list(label_values)[0]
def get_en_label(entity):
if 'en' in entity['labels']:
return entity['labels']['en']['value']