{# This is the paradigm template for Inari Sámi. * Nouns: Display everything in the paradigm in a definition list * Verbs: Display a table with one column for present tense, and one for preterite tense; then display a separate definition list for nonfinite forms. For the negative verb and supinum negative verb, we also add a title on the table. - These are controlled by tagsets. Including more forms for verbs can be handled by adding more tags to the file `tagsets/smn.tagset` #} {%- set first_l = lexicon_entry|xpath('lg/l')|first %} {% set lemma = first_l|text %} {% set pos = first_l|xpath('@pos')|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", "Prt") |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 prt_text = "Prt"|tagfilter(_from, _to) %} {% set conneg_text = "ConNeg"|tagfilter(_from, _to) %} {% set verb_text = "V"|tagfilter(_from, _to) %} {% set verb_text_ind = "Ind"|tagfilter(_from, _to) %} {% set sup_text = "Sup"|tagfilter(_from, _to) %} {% set neg_text = "Neg"|tagfilter(_from, _to) %} {% set nonfinite_header = False %} {% set is_supinum = nonfinite_forms|by_tagset("supinum")|length > 0 %} {# we'll know this isn't just a normal verb with a couple negative forms because there are 9 #} {% set is_negative = nonfinite_forms|by_tagset("negative")|length == 9 %} {% if is_supinum and is_negative %} {% set nonfinite_header = sup_text + " " + neg_text %} {% endif %} {% if is_negative and not is_supinum %} {% set nonfinite_header = neg_text %} {% endif %} {% macro clean_tag(tag_input) -%} {% set filtered_tag = tag_input|tagfilter(_from, _to) %} {% if nonfinite_header and (is_supinum or is_negative) %} {% set filtered_tag = filtered_tag|replace(sup_text, "") |replace(neg_text, "") %} {% endif %} {% if conneg_text in filtered_tag %} {{ filtered_tag|replace(verb_text, "") |replace(verb_text_ind, "") }} {% else %} {{ filtered_tag|replace(prs_text, "") |replace(prt_text, "") |replace(verb_text, "") |replace(verb_text_ind, "") }} {% endif %} {%- endmacro %} {%- endif %} {%- if pos|upper == 'N' or pos|upper == 'NUM' %} {% 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) %} {% endif %} {% macro clean_tag(tag_input) %} {{ tag_input|tagfilter(_from, _to) |replace(pos_text, "") |replace(sg_text, "") |replace(pl_text, "") }} {% endmacro %} {% endif -%} {%- if pos|upper == 'A' %} {% set adj_text = "A"|tagfilter(_from, _to) %} {% macro clean_tag(tag_input) %} {{ tag_input|tagfilter(_from, _to) |replace(adj_text, "") }} {% endmacro %} {% endif -%} {%- if pos|upper == 'PRON' %} {% set pron_text = "Pron"|tagfilter(_from, _to) %} {% set indef_text = "Indef"|tagfilter(_from, _to) %} {% set sg_text = "Sg"|tagfilter(_from, _to) %} {% set pl_text = "Pl"|tagfilter(_from, _to) %} {% set pron_type = lexicon_entry|xpath('./lg/l/@type')|first %} {% set pron_type_text = pron_type|tagfilter(_from, _to) %} {# If there are nomainal number markings, then we'll split these into two columns. Must determine this by checking the tagsets. Works for words like eará, soames, etc. TODO: mii +Rel gii +Rel makkár +Rel / +Interr dat nr="Sg", type="Dem" dat nr="Pl", type="Dem" recipr is broken /detail/smn/nob/goabbat%20guoimmisteame.html #} {% set two_columns = False %} {% set sg_forms = paradigm|by_tagset_value("number", "Sg")|group_by_tag %} {% set pl_forms = paradigm|by_tagset_value("number", "Pl")|group_by_tag %} {% if sg_forms|length > 0 and pl_forms|length > 0 %} {% set two_columns = True %} {% set zipped_numbers = izip_longest(sg_forms, pl_forms, fillvalue='-')|list %} {% set numberless_forms = paradigm|by_tagset("nouns_null_number") %} {% endif %} {% macro clean_tag(tag_input) %} {% if two_columns %} {{ tag_input|tagfilter(_from, _to) |replace(pron_text, "") |replace(sg_text, "") |replace(pl_text, "") |replace(pron_type_text, "") }} {% else %} {{ tag_input|tagfilter(_from, _to) |replace(pron_text, "") |replace(pron_type_text, "") }} {% endif %} {% 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 -%}
{{ prs_text }} (onne) {{ prt_text }} (jieht)
{{ tag_display }}{{ present_forms|join('
', attribute='form') }}
{{ preterite_forms|join('
', attribute='form') }}
{% endif %}
{% if nonfinite_header %}
{{ nonfinite_header }}
 
{% endif %} {% set noninf_forms = nonfinite_forms|group_by_tag %} {% for var in noninf_forms %} {% if var[0].tag %}
{{ clean_tag(var[0].tag) }}
{% endif %}
{{ var|join('
', attribute='form') }}
{% endfor %}
{% endif %} {% elif pos|upper == 'N' or pos|upper == 'NUM' %} {% 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 -%} {% set numb_forms = numberless_forms|group_by_tag %} {% for var in numb_forms %} {% if var[0].tag %} {% endif %} {% endfor %}
{{ sg_text }} {{ pl_text }}
{{ tag_display }}{{ sgs|join('
', attribute='form') }}
{{ pls|join('
', attribute='form') }}
{{ clean_tag(var[0].tag) }}{{ var|join('
', attribute='form') }}
{% endif %} {% elif pos|upper == 'A' %}
{% set adj_forms = paradigm|group_by_tag %} {% for var in adj_forms %} {% if var[0].tag %}
{{ clean_tag(var[0].tag) }}
{% endif %}
{{ var|join('
', attribute='form') }}
{% endfor %}
{% elif pos|upper == 'PRON' %} {% if pron_type|upper == 'INDEF' and two_columns %} {% 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 %} {% else %}
{{ pron_text }} {{ pron_type_text }}
 
{%- for form in paradigm -%} {% if form.tag %}
{{ clean_tag(form.tag) }}
{% endif %} {% if form.form %}
{{ form.form }}
{% else %}
?
{% endif %} {%- endfor -%}
{% endif %} {% 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 %} {{ full_paradigm_link() }} {% endif %} {% endif -%} {# vim: set ts=4 sw=4 tw=72 syntax=htmljinja : #}