{# This is the paradigm template for North Sámi. * Nouns: Display everything in the paradigm in a definition list * Verbs: TBD, but can probably copy from sme when ready? minus dual #} {%- set first_l = lexicon_entry|xpath('lg/l')|first %} {% set lemma = first_l|text %} {% set pos = first_l|xpath('@pos')|first %} {% set pos_type = first_l|xpath('@type')|first %} {% set has_forms = paradigm and paradigm|length > 0 -%} {% set paradigm_exists = paradigm|length > 0 %} {%- if pos|upper == 'V' %} {% set verbs = true %} {% set present_verbs = paradigm|by_tagset_value("tense", "Prs") |without_tagset("negation") |group_by_tag %} {% set preterite_verbs = paradigm|by_tagset_value("tense", "Prt1") |without_tagset("negation") |group_by_tag %} {% set nonfinite_forms = paradigm|by_tagset("nonfinite_paradigm") %} {# As long as the paradigm files are in order, this will zip accurately. If not we need to manually select each form and display it. #} {# Use izip_longest to fill in the extra blanks spaces when one list ends first #} {% set zipped_verbs = izip_longest(present_verbs, preterite_verbs, fillvalue='-')|list %} {% set paradigm_exists = zipped_verbs|length > 0 or nonfinite_forms|length > 0 %} {# strip some parts of the tags that we don't need #} {% set prs_text = "Prs"|tagfilter(_from, _to) %} {% set prt1_text = "Prt1"|tagfilter(_from, _to) %} {% set nonfinite_header = False %} {# we'll know this isn't just a normal verb with a couple negative forms because there are 9 #} {% macro clean_tag(tag_input) -%} {{ tag_input|remove_by_tagset('invisible_in_verb_paradigms') |tagfilter(_from, _to) }} {%- endmacro %} {% macro clean_nonf_tag(tag_input) -%} {{ tag_input|remove_by_tagset('invisible_in_verb_nonfinite_paradigms') |tagfilter(_from, _to) }} {%- endmacro %} {%- endif %} {%- if pos|upper == 'N' or pos|upper == 'NUM' or pos|upper == 'A' and pos_type != 'Prop' %} {% set sg_forms = paradigm|by_tagset_value("number", "Sg")|group_by_tag %} {% set pl_forms = paradigm|by_tagset_value("number", "Pl")|group_by_tag %} {# Use izip_longest to fill in the extra blanks spaces when one list ends first #} {% set zipped_numbers = izip_longest(sg_forms, pl_forms, fillvalue='-')|list %} {% set paradigm_exists = zipped_numbers|length > 0 %} {% set numberless_forms = paradigm|by_tagset("nouns_null_number") %} {% set sg_text = "Sg"|tagfilter(_from, _to) %} {% set pl_text = "Pl"|tagfilter(_from, _to) %} {% if pos|upper == 'N' %} {% set pos_text = pos|upper|tagfilter(_from, _to) %} {% elif pos|upper == 'NUM' %} {% set pos_text = 'Num'|tagfilter(_from, _to) %} {% elif pos|upper == 'A' %} {% set pos_text = 'A'|tagfilter(_from, _to) %} {% endif %} {% macro clean_tag(tag_input) %} {{ tag_input|remove_by_tagset('invisible_in_noun_paradigms') |tagfilter(_from, _to) }} {% endmacro %} {% endif -%} {%- if pos|upper == 'N' and pos_type == 'Prop' %} {% macro clean_tag(tag_input) %} {{ tag_input|remove_by_tagset('invisible_in_noun_paradigms') |tagfilter(_from, _to) }} {% endmacro %} {% endif -%} {%- if pos|upper == 'A' %} {% macro clean_tag(tag_input) -%} {{ tag_input|remove_by_tagset('invisible_in_adj_paradigms') |tagfilter(_from, _to) }} {%- endmacro %} {%- endif %} {%- if pos|upper == 'PRON' %} {% macro clean_tag(tag_input) -%} {{ tag_input|remove_by_tagset('invisible_in_pron_paradigms') |tagfilter(_from, _to) }} {%- endmacro %} {%- endif %} {%- macro full_paradigm_link() %} {%- trans -%}Full paradigm{%- endtrans -%}  → {% endmacro -%} {%- if has_forms %} {%- if pos|upper == 'V' %} {% if paradigm_exists %} {% if zipped_verbs %} {# This is the two-column tense paradigm #} {%- for present_forms, preterite_forms in zipped_verbs -%} {% if present_forms[0].tag %} {% set tag_display = clean_tag(present_forms[0].tag) %} {% elif preterite_forms[0].tag %} {% set tag_display = clean_tag(preterite_forms[0].tag) %} {% endif %} {% if present_forms and present_forms != '-' %} {% else %} {% endif %} {% if preterite_forms and preterite_forms != '-' %} {% else %} {% endif %} {%- endfor -%} {# sg4? {%- for form in numberless_forms -%} {% if form.tag %} {% endif %} {% if form.form %} {% else %} {% endif %} {%- endfor -%} #}
{{ prs_text }} (тячи) {{ prt1_text }} (исяк)
{{ tag_display }}{{ present_forms|join('
', attribute='form') }}
{{ preterite_forms|join('
', attribute='form') }}
{{ clean_tag(form.tag) }}{{ form.form }}?
{% endif %}
{% if nonfinite_header %}
{{ nonfinite_header }}
 
{% endif %} {%- for form in nonfinite_forms -%} {% if form.tag %}
{{ clean_nonf_tag(form.tag) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% endif %} {% elif pos|upper == 'N' %} {% if pos_type != 'Prop' %} {% if paradigm_exists %} {%- for sgs, pls in zipped_numbers -%} {% if sgs[0].tag %} {% set tag_display = clean_tag(sgs[0].tag) %} {% elif pls[0].tag %} {% set tag_display = clean_tag(pls[0].tag) %} {% endif %} {% if sgs and sgs != '-' %} {% else %} {% endif %} {% if pls and pls != '-' %} {% else %} {% endif %} {%- endfor -%} {%- for form in numberless_forms -%} {% if form.tag %} {% endif %} {% if form.form %} {% else %} {% endif %} {%- endfor -%}
{{ sg_text }} {{ pl_text }}
{{ tag_display }}{{ sgs|join('
', attribute='form') }}
{{ pls|join('
', attribute='form') }}
{{ clean_tag(form.tag) }}{{ form.form }}?
{% endif %} {% elif pos_type == 'Prop' %} {% if paradigm_exists %}
{%- for form in paradigm -%} {% if form.tag %}
{{ clean_tag(form.tag) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% endif %} {% endif %} {% elif pos|upper == 'A' %}
{%- for form in paradigm -%} {% if form.tag %}
{{ clean_tag(form.tag) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% elif pos|upper == 'PRON' %}
{%- for form in paradigm -%} {% if form.tag %}
{{ clean_tag(form.tag) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% else %}
{%- for form in paradigm -%} {% if form.tag %}
{{ form.tag|tagfilter(_from, _to) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% endif %} {% if paradigm_exists and pos|upper != 'PRON' %} {{ full_paradigm_link() }} {% endif %} {% endif -%} {# vim: set ts=4 sw=4 tw=72 syntax=htmljinja : #}