From 6d9aee4e2c2e423a5e1393cb85cd7ba808b62790 Mon Sep 17 00:00:00 2001 From: susanodd Date: Wed, 29 May 2024 13:11:05 +0200 Subject: [PATCH] #1238: Added morphology to json package API. --- signbank/api_interface.py | 7 +++++-- signbank/dictionary/models.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/signbank/api_interface.py b/signbank/api_interface.py index aea286fc6..f2a102720 100644 --- a/signbank/api_interface.py +++ b/signbank/api_interface.py @@ -65,13 +65,16 @@ def api_fields(dataset, language_code='en', advanced=False): api_fields_2023.append(_("Video")) api_fields_2023.append(_("Tags")) api_fields_2023.append(_("Affiliation")) + api_fields_2023.append(_("Sequential Morphology")) + api_fields_2023.append(_("Simultaneous Morphology")) + api_fields_2023.append(_("Blend Morphology")) fieldnames = FIELDS['main'] + FIELDS['phonology'] + FIELDS['semantics'] + ['inWeb', 'isNew', 'excludeFromEcv'] gloss_fields = [Gloss.get_field(fname) for fname in fieldnames if fname in Gloss.get_field_names()] # TO DO - extra_columns = ['Sign Languages', 'Dialects', 'Sequential Morphology', 'Simultaneous Morphology', - 'Blend Morphology', 'Relations to other signs', 'Relations to foreign signs', 'Notes'] + extra_columns = ['Sign Languages', 'Dialects', + 'Relations to other signs', 'Relations to foreign signs', 'Notes'] # show advanced properties for field in gloss_fields: diff --git a/signbank/dictionary/models.py b/signbank/dictionary/models.py index 6c7a2839a..63bd56476 100755 --- a/signbank/dictionary/models.py +++ b/signbank/dictionary/models.py @@ -1504,6 +1504,21 @@ def get_fields_dict(self, fieldnames, language_code='en'): affiliation_names_of_gloss = sorted(affiliation_names_of_gloss) fields[affiliation_fieldname] = affiliation_names_of_gloss + sequential_morphology_fieldname = gettext("Sequential Morphology") + sequential_morphology = self.get_hasComponentOfType_display() + if sequential_morphology: + fields[sequential_morphology_fieldname] = sequential_morphology + + simultaneous_morphology_fieldname = gettext("Simultaneous Morphology") + simultaneous_morphology = self.get_morpheme_display() + if simultaneous_morphology: + fields[simultaneous_morphology_fieldname] = simultaneous_morphology + + blend_morphology_fieldname = gettext("Blend Morphology") + blend_morphology = self.get_blendmorphology_display() + if blend_morphology: + fields[blend_morphology_fieldname] = blend_morphology + return fields @staticmethod