Module:aau-noun

Hello, you have come here looking for the meaning of the word Module:aau-noun. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:aau-noun, but we will also tell you about its etymology, its characteristics and you will know how to say Module:aau-noun in singular and plural. Everything you need to know about the word Module:aau-noun you have here. The definition of the word Module:aau-noun will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:aau-noun, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local export = {}

-- Mapping from Roman numeral (uppercase) to Arabic numeral
local roman_to_arabic = {
     = 1,  = 2,  = 3,  = 4,  = 5,  = 6,
     = 7,  = 8,  = 9,  = 10,  = 11,  = 12
}

-- Short descriptions for noun classes (based on Lock 2011, p. 57, 59-61)
local class_descriptions = {
     = "humans/spirits",
     = "non-human/default",
     = "small 3D objects",
     = "flat objects/experience",
     = "long thin objects",
     = "geographical locations",
     = "flat 2D objects",
     = "selected trees",
     = "stored long bundles",
     = "temporal",
     = "transported long bundles",
     = "pieces/chunks"
}

-- Full descriptions for gender codes
local gender_descriptions = {
     = "masculine",
     = "feminine",
     = "masculine+feminine"
}

function export.show(frame)
    local args = frame:getParent().args
    local class_input = args
    local gender_input = args

    local class_arabic = nil
    local class_display = tostring(class_input or "") -- Default to input string or empty

    -- Validate and process class input (handle numbers and Roman numerals)
    if class_input then
        -- Check if it's a number string
        local num_val = tonumber(class_input)
        if num_val and num_val >= 1 and num_val <= 12 then
            class_arabic = num_val
            -- Assume Roman numeral display for 1-12 as in the grammar tables
             local arabic_to_roman = {}
             for roman, arabic in pairs(roman_to_arabic) do
                 arabic_to_roman = roman
             end
            class_display = arabic_to_roman -- Use Roman numeral
        else
            -- Check if it's a valid Roman numeral string (only I-XII)
            local roman_upper = mw.ustring.upper(tostring(class_input))
            if roman_to_arabic and roman_to_arabic >= 1 and roman_to_arabic <= 12 then
                class_arabic = roman_to_arabic
                class_display = roman_upper -- Display the uppercase Roman numeral
            else
                 -- Input is not a valid number 1-12 or Roman numeral I-XII
                 class_display = tostring(class_input) -- Display as given
            end
        end
    end

    -- Get class description for tooltip
    local class_tooltip = "invalid class"
    if class_arabic and class_descriptions then
        class_tooltip = "noun class " .. class_arabic .. " (" .. class_descriptions .. ")"
    end

    -- Validate and process gender input
    local gender_display = tostring(gender_input or "") -- Default to input string or empty
    local gender_tooltip = "invalid gender"
    local gender_lower = mw.ustring.lower(gender_display)
    if gender_descriptions then
        gender_tooltip = gender_descriptions
        gender_display = gender_lower -- Use lowercase code for consistent display if valid
    end

    -- Construct the output string using mw.text.tag for <abbr>
    -- This generates the wikitext "{{#tag:abbr|...}}" syntax.
    local class_abbr_wikitext = mw.text.tag('abbr', { title = class_tooltip }, class_display)
    local gender_abbr_wikitext = mw.text.tag('abbr', { title = gender_tooltip }, gender_display)

    -- Combine the parts into the final output string
    local output_string = "''class " .. class_abbr_wikitext .. " gender " .. gender_abbr_wikitext .. "''"

    return output_string
end

return export