Jump to content

Module:nn-verb-classes

From Wiktionary, the free dictionary

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

-- Experimental module

local p = {}


function p.v1(word)
    --word = frame.args[1]
    length = word:len()
    root = word:sub(1, length-1)
    inflection = {}
    inflection['present tense'] =  root .. 'ar'
    inflection['past tense'] = root .. 'a'
    inflection['past participle'] = root .. 'a'
    inflection['passive infinitive'] = root .. 'ast'
    inflection['present participle'] = root .. 'ande' 
    inflection['imperative'] =  root
    inflection['imperative2'] = word
    inflection['adj f and m'] = root .. 'a'
    inflection['adj n'] = root .. 'a'
    inflection['adj def sg and pl'] = root .. 'a'
    
    inflection['verbal noun'] = root .. 'ing'
    inflection['agent noun'] = root .. 'ar'
    return inflection
end    

function p.v2(word)
    --word = frame.args[1]
    length = word:len()
    root = word:sub(1, length-1)
    inflection = {}    
    inflection['present tense'] =  root .. 'er'
    inflection['past tense'] = root .. 'te'
    inflection['past participle'] = root .. 't'
    inflection['passive infinitive'] = root .. 'ast'
    inflection['present participle'] = root .. 'ande' 
    inflection['imperative'] =  root
    inflection['adj f and m'] = root .. 't'
    inflection['adj n'] = root .. 't'
    inflection['adj def sg and pl'] = root .. 'te'
    
    inflection['verbal noun'] = root .. 'ing'
    inflection['agent noun'] = root .. 'ar'
    return inflection
end    
 
function p.v3(word)
    --word = frame.args[1]
    length = word:len()
    root = word:sub(1, length-1)
    inflection = {}
    
    if root:sub(length-1, length-1) == 'j' then
        root2 = root:sub(1, length-2)
    else
        root2 = root
    end
    length2 = root2:len()
    if root2:sub(length2, length2) == root2:sub(length2-1, length2-1) then
        root3 = root2:sub(1, length2-1)
    else
        root3 = root2
    end
    if word:find('[iouyæøå]$') then
        present_tense = word .. 'r'
    else
        present_tense = root .. 'er'
    end
    if not root3:find('ng$') and not root3:find('r$') and not root:find('øym') then
        if root3:find('[aeiouyæøå]$') then
            past_tense = root3 .. 'dde'
            past_participle = root3 .. 'dd'
            past_participle2 = root3 .. 'tt'
        else
            past_tense = root3 .. 'de'
            past_participle = root3 .. 'd'
            past_participle2 = root3 .. 't'
        end
    else
        past_tense = root3 .. 'de'
        past_participle = root3 .. 't'
    end
    passive_infinitive = root .. 'ast'
    present_participle = root .. 'ande'
    imperative = root2
    
    inflection['present tense'] =  present_tense
    inflection['past tense'] = past_tense
    inflection['past participle'] = past_participle
    inflection['past participle2'] = past_participle2
    inflection['passive infinitive'] = passive_infinitive
    inflection['present participle'] = present_participle
    inflection['imperative'] =  imperative
    inflection['verbal noun'] = root3 .. 'ing'
    inflection['agent noun'] = root .. 'ar'
    return inflection
end 

function p.v4(frame)
    word = frame.args[1]
    length = word:len()
    root = word:sub(1, length-1)
    inflection = {}
    if root:sub(length-1, length-1) == root:sub(length-2, length-2) then
        root2 = root:sub(1, length-2)
    else
        root2 = root
    end
    present_tense = root .. 'er'
    past_tense = root2 .. 'de'
    past_tense2 = root2 .. 'te'
    past_participle = root2 .. 't' 
    passive_infinitive = root .. 'ast'
    present_participle = root .. 'ande'
    imperative = root2
    
    inflection['present tense'] =  present_tense
    inflection['past tense'] = past_tense
    inflection['past tense2'] = past_tense2
    inflection['past participle'] = past_participle
    inflection['passive infinitive'] = passive_infinitive
    inflection['present participle'] = present_participle
    inflection['imperative'] =  imperative
    
    inflection['verbal noun'] = root .. 'ing'
    inflection['agent noun'] = root .. 'ar'
end

return p