Module:ko-conj: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
Wyang (talk | contribs)
No edit summary
다다르다 and 들르다 are not 르 irregular verbs
Line 92: Line 92:
end
end
elseif stem1_jungseong == 'ᅳ' then
elseif stem1_jungseong == 'ᅳ' then
if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 47476 then
if (mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 47476) and not (mw.ustring.match(stem1, '다다르') or mw.ustring.match(stem1, '들르')) then
if mw.ustring.gsub(mw.ustring.sub(stem1,-2,-1),'[누푸]르','') == '' then
if mw.ustring.gsub(mw.ustring.sub(stem1,-2,-1),'[누푸]르','') == '' then
irregtype = 'reo'
irregtype = 'reo'

Revision as of 12:19, 16 May 2015

Korean adjective/verb conjugator.

See Template:ko-conj-adj/auto and Template:ko-conj-verb/auto for examples.


local export={}
local m_translit = require('Module:ko-translit')

function export.adjective(frame)
	local word = frame.args[1] or mw.title.getCurrentTitle()
	local irreg = frame.args["irreg"] or ''
	local north = frame.args["north"] or ''
	local honorific = frame.args["honorific"] or 'yes'
	local phonetic = (frame.args["phon"] and frame.args["phon"] ~= "") and mw.ustring.sub(frame.args["phon"], 1, -2) or false
	local honorific_note = frame.args["honorific_note"] or ''
	local form = frame.args["form"] or ''
	local forms = {}
	local honforms = {}
	local irregtype = ''
	local stem1,stem2,stem3,stem2a,haet,hayeot,ham,han,hal,hap,irregtype='','','','','','','','','','',''
	local consonant_stem = true
	
	stem1 = mw.ustring.sub(word,1,-2)
	prestem1 = mw.ustring.sub(stem1,1,-2)
	stem1last_basic = mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1))
	stem1last = stem1last_basic - 0xAC00
	stem1_jongseong = stem1last % 28
	if stem1_jongseong == 0 then
		stem1_jongseong = ''
	else
		stem1_jongseong = mw.ustring.char(0x11A7 + stem1_jongseong)
	end
	
	stem1_jungseong = math.floor((stem1last % 588) / 28)
	stem1_jungseong = mw.ustring.char(0x1161 + stem1_jungseong)
	
	if stem1_jongseong == '' then
		consonant_stem = false
		hal = prestem1 .. mw.ustring.char(stem1last_basic + 8)
		ham = prestem1 .. mw.ustring.char(stem1last_basic + 16)
		han = prestem1 .. mw.ustring.char(stem1last_basic + 4)
		hap = prestem1 .. mw.ustring.char(stem1last_basic + 17)
		
		if stem1_jungseong == 'ᅡ' then
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 54616 then
				irregtype = 'ha'
				stem2 = prestem1 .. mw.ustring.char(stem1last_basic + 28)
				haet = prestem1 .. '했'
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				haet = prestem1 .. mw.ustring.char(stem1last_basic + 20)
			end
		elseif stem1_jungseong == 'ᅵ' then
			nsdiff = 'y'
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 392)
			haet = prestem1 .. mw.ustring.char(stem1last_basic - 372)
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 49884 then
				if irreg == 'y' then
					irregtype = 'si'
					honorific = 'no'
					stem2a = prestem1 .. '세'
					honorific_note = "''This adjective is in honorific form.''"
				end
			elseif north == 'y' then
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				stem2a = stem1 .. '어'
				hayeot = stem1 .. '었'
			end
		elseif mw.ustring.match(stem1_jungseong,'[ᅢᅦ]') then
			nsdiff = 'y'
			haet = prestem1 .. mw.ustring.char(stem1last_basic + 20)
			if north == 'y' then
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				stem2a = stem1 .. '어'
				hayeot = stem1 .. '었'
			end
		elseif stem1_jungseong == 'ᅩ' then
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic + 28)
			haet = prestem1 .. mw.ustring.char(stem1last_basic + 48)
			stem2a = stem1 .. '아'
			hayeot = stem1 .. '았'
		elseif stem1_jungseong == 'ᅬ' then
			nsdiff = 'y'
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 28)
			haet = prestem1 .. mw.ustring.char(stem1last_basic - 8)
			if north == 'y' then
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				stem2a = stem1 .. '어'
				hayeot = stem1 .. '었'
			end
		elseif stem1_jungseong == 'ᅳ' then
			if (mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 47476) and not (mw.ustring.match(stem1, '다다르') or mw.ustring.match(stem1, '들르')) then
				if mw.ustring.gsub(mw.ustring.sub(stem1,-2,-1),'[누푸]르','') == '' then
					irregtype = 'reo'
					stem2 = stem1 .. '러'
					haet = stem1 .. '렀'
				else
					irregtype = 'reu'
					antepenultimate = mw.ustring.sub(prestem1,1,-2)
					penultimate = mw.ustring.codepoint(mw.ustring.sub(prestem1,-1,-1))
					penultimate_vowel = mw.ustring.char(0x1161 + math.floor(((penultimate - 0xAC00) % 588) / 28))
					if mw.ustring.match(penultimate_vowel,'[ᅡᅩ]') then
						stem2 = antepenultimate .. mw.ustring.char(penultimate + 8) .. '라'
						haet = antepenultimate .. mw.ustring.char(penultimate + 8) .. '랐'
					else
						stem2 = antepenultimate .. mw.ustring.char(penultimate + 8) .. '러'
						haet = antepenultimate .. mw.ustring.char(penultimate + 8) .. '렀'
					end
				end
			else
				if mw.ustring.len(stem1) ~= 1 then
					penultimate = mw.ustring.codepoint(mw.ustring.sub(prestem1,-1,-1))
					penultimate_vowel = mw.ustring.char(0x1161 + math.floor(((penultimate - 0xAC00) % 588) / 28))
				else
					penultimate_vowel = 'ᅥ'
				end
				if mw.ustring.match(penultimate_vowel,'[ᅡᅩ]') then
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 504)
					haet = prestem1 .. mw.ustring.char(stem1last_basic - 484)
				else
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 392)
					haet = prestem1 .. mw.ustring.char(stem1last_basic - 372)
				end
			end
		elseif stem1_jungseong == 'ᅮ' then
			if mw.ustring.sub(stem1,-1,-1) == '우' then
				stem2 = prestem1 .. '워'
				haet = prestem1 .. '웠'
			else
				stem2 = stem1 .. '어'
				haet = stem1 .. '었'
				stem2a = prestem1 .. mw.ustring.char(stem1last_basic + 28)
				hayeot = prestem1 .. mw.ustring.char(stem1last_basic + 48)
			end
		else
			nsdiff = 'y'
			if north == 'y' then
				stem2 = stem1 .. '여'
				haet = stem1 .. '였'
			else
				stem2 = stem1 .. '어'
				haet = stem1 .. '었'
			end
		end
	else
		if irreg == 'y' then
			if stem1_jongseong == 'ᇂ' then
				cstem = 'y'
				irregtype = 'h'
				if (mw.ustring.match(stem1, '[이요그고저조무]렇') or mw.ustring.match(stem1, '어떻')) and not mw.ustring.match(stem1, '[성더덩둥뚱댕뎅]그렇') then
					irregtype = 'det-h'
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 111)
					haet = prestem1 .. mw.ustring.char(stem1last_basic - 91)
				else
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic + 1)
					haet = prestem1 .. mw.ustring.char(stem1last_basic + 21)
				end
				stem3 = prestem1 .. mw.ustring.char(stem1last_basic - 27)
				hal = prestem1 .. mw.ustring.char(stem1last_basic - 19)
				ham = prestem1 .. mw.ustring.char(stem1last_basic - 11)
				han = prestem1 .. mw.ustring.char(stem1last_basic - 23)
			elseif stem1_jongseong == 'ᆺ' then
				cstem = 'y'
				irregtype = 's'
				de_s = mw.ustring.char(stem1last_basic - 19)
				stem3 = prestem1 .. de_s .. '으'
				ham = prestem1 .. de_s .. '음'
				hal = prestem1 .. de_s .. '을'
				han = prestem1 .. de_s .. '은'
				if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
					stem2 = prestem1 .. de_s .. '아'
					haet = prestem1 .. de_s .. '았'
				else
					stem2 = prestem1 .. de_s .. '어'
					haet = prestem1 .. de_s .. '었'
				end
			elseif stem1_jongseong == 'ᆸ' then
				cstem = 'y'
				irregtype = 'p'
				de_p = mw.ustring.char(stem1last_basic - 17)
				stem3 = prestem1 .. de_p .. '우'
				ham = prestem1 .. de_p .. '움'
				hal = prestem1 .. de_p .. '울'
				han = prestem1 .. de_p .. '운'
				if mw.ustring.len(stem1) == 1 then
					if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
						stem2 = prestem1 .. de_p .. '와'
						haet = prestem1 .. de_p .. '왔'
					else
						stem2 = prestem1 .. de_p .. '워'
						haet = prestem1 .. de_p .. '웠'
					end
				else
					nsdiff = 'y'
					if north == 'y' then
						if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
							stem2 = prestem1 .. de_p .. '와'
							haet = prestem1 .. de_p .. '왔'
						else
							stem2 = prestem1 .. de_p .. '워'
							haet = prestem1 .. de_p .. '웠'
						end
					else
						stem2 = prestem1 .. de_p .. '워'
						haet = prestem1 .. de_p .. '웠'
					end
				end
			else
				return error("Irregular irregtype unrecognised.")
			end
		elseif stem1_jongseong == 'ᆯ' then
			cstem = 'n'
			irregtype = 'l'
			stem3 = prestem1 .. mw.ustring.char(stem1last_basic - 8)
			ham = prestem1 .. mw.ustring.char(stem1last_basic + 2)
			hal = stem1
			han = prestem1 .. mw.ustring.char(stem1last_basic - 4)
			hap = prestem1 .. mw.ustring.char(stem1last_basic + 9)
			if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
				stem2 = stem1 .. '아'
			else
				stem2 = stem1 .. '어'
			end
		else
			cstem = 'y'
			stem3 = stem1 .. '으'
			if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
				stem2 = stem1 .. '아'
			else
				stem2 = stem1 .. '어'
			end
		end
	end
	if haet == '' then
		if stem2 == (stem1 .. '어') then
			haet = stem1 .. '었'
		elseif stem2 == (stem1 .. '아') then
			haet = stem1 .. '았'
		end
	end
	if stem2 == '' then
		stem2 = stem1
	end
	if stem3 == '' then
		stem3 = stem1
	end
	if han == '' then
		if mw.ustring.match(mw.ustring.sub(stem1,-1,-1),'[있없]') then
			irregtype = 'ex'
			han = stem1 .. '는'
		else
			han = stem1 .. '은'
		end
	end
	if ham == '' then
		ham = stem1 .. '음'
	end
	if hal == '' then
		hal = stem1 .. '을'
	end
	
	if form == 'hae' then
		return stem2
	elseif form == 'hae2' then
		return stem2a
	elseif form == 'hani' then
		return stem3 .. '니'
	end

	forms["lemma"] = stem1 .. '다'
	forms["ind_hrc"] = stem1 .. '다'
	forms["ind_hrc_past"] = haet .. '다'
	forms["ind_hc"] = stem2
	forms["ind_hc_past"] = haet .. '어'
	forms["ind_hyc"] = stem2 .. '요'
	forms["ind_hyc_alt"] = ''
	forms["ind_hyc_past"] = haet .. '어요'
	forms["ind_hssoc_past"] = haet .. '습니다'
	forms["interrog_hc"] = stem2
	forms["interrog_hc_past"] = haet .. '어'
	forms["interrog_hyc"] = stem2 .. '요'
	forms["interrog_hyc_alt"] = ''
	forms["interrog_hyc_past"] = haet .. '어요'
	forms["interrog_hssoc_past"] = haet .. '습니까'
	forms["assert_hrc"] = stem1 .. '겠다'
	forms["assert_hc"] = stem1 .. '겠어'
	forms["assert_hyc"] = stem1 .. '겠어요'
	forms["assert_hssoc"] = stem1 .. '겠습니다'
	forms["cause_hrc"] = stem2
	forms["cause_hc"] = stem2 .. '서'
	forms["cause_hc_alt"] = ''
	forms["cause_hyc"] = stem3 .. '니'
	forms["cause_hssoc"] = stem3 .. '니까'
	forms["contrast_hrc"] = stem1 .. '지만'
	forms["contrast_hc"] = han .. '데'
	forms["contrast_hyc"] = stem1 .. '더니'
	forms["conjunction"] = stem1 .. '고'
	forms["condition_hc"] = stem2 .. '야'
	forms["condition_hc_alt"] = ''
	forms["vn_um"] = ham
	forms["vn_gi"] = stem1 .. '기'
	forms["vn_um_past"] = haet .. '음'
	forms["vn_gi_past"] = haet .. '기'
	forms["vn_um_past_alt"] = ''
	forms["vn_gi_past_alt"] = ''
	forms["determ_pres"] = han
	forms["determ_fut"] = hal

	if irregtype ~= 'ha' then
		if stem2a ~= '' then
			forms["ind_hyc_alt"] = stem2a .. '요'
			forms["interrog_hyc_alt"] = stem2a .. '요'
		end
	end
	if mw.ustring.match(mw.ustring.sub(stem1,-1,-1),'[있없]') then
		forms["interrog_hrc"] = stem1 .. '느냐'
		forms["interrog_hrc_past"] = haet .. '느냐'
	else
		forms["interrog_hrc"] = stem3 .. '냐'
		forms["interrog_hrc_past"] = haet .. '냐'
	end
	if cstem == 'y' then
		forms["ind_hssoc"] = stem1 .. '습니다'
		forms["interrog_hssoc"] = stem1 .. '습니까'
	else
		if hap == '' then
			forms["ind_hssoc"] = stem1 .. '읍니다'
			forms["interrog_hssoc"] = stem1 .. '읍니까'
		else
			forms["ind_hssoc"] = hap .. '니다'
			forms["interrog_hssoc"] = hap .. '니까'
		end
	end
	if stem1 == hal then
		forms["condition_hrc"] = stem1 .. '면'
	else
		forms["condition_hrc"] = stem3 .. '면'
	end
	if stem2a ~= '' and irregtype ~= 'si' then
		forms["cause_hc_alt"] = stem2a .. '서'
		forms["condition_hc_alt"] = stem2a .. '야'
	end
	if hayeot ~= '' then
		forms["vn_um_past_alt"] = hayeot .. '음'
		forms["vn_gi_past_alt"] = hayeot .. '기'
	end

	for key, form in pairs(forms) do
		if forms[key] ~= '' then
			forms[key] = ('<span class="Kore", lang="ko">' .. form ..
				'</span> <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(form, stem1, phonetic) or form) .. ')</span>')
		end
	end
	if forms["ind_hyc_alt"] ~= '' then
		if irregtype == 'si' then
			forms["ind_hyc"] = forms["ind_hyc_alt"] .. ' or ' .. forms["ind_hyc"]
		else
			forms["ind_hyc"] = forms["ind_hyc"] .. ' or ' .. forms["ind_hyc_alt"]
		end
	end
	if forms["interrog_hyc_alt"] ~= '' then
		if irregtype == 'si' then
			forms["interrog_hyc"] = forms["interrog_hyc_alt"] .. ' or ' .. forms["interrog_hyc"]
		else
			forms["interrog_hyc"] = forms["interrog_hyc"] .. ' or ' .. forms["interrog_hyc_alt"]
		end
	end
	if forms["cause_hc_alt"] ~= '' then
		forms["cause_hc"] = forms["cause_hc"] .. ' or ' .. forms["cause_hc_alt"]
	end
	if forms["condition_hc_alt"] ~= '' then
		forms["condition_hc"] = forms["condition_hc"] .. ' or ' .. forms["condition_hc_alt"]
	end
	if forms["vn_um_past_alt"] ~= '' then
		forms["vn_um_past"] = forms["vn_um_past"] .. ' or ' .. forms["vn_um_past_alt"]
	end
	if forms["vn_gi_past_alt"] ~= '' then
		forms["vn_gi_past"] = forms["vn_gi_past"] .. ' or ' .. forms["vn_gi_past_alt"]
	end
	
	if honorific == 'yes' then
		honforms["ind_hrc"] = stem3 .. '시다'
		honforms["ind_hrc_past"] = stem3 .. '셨다'
		honforms["ind_hc"] = stem3 .. '셔'
		honforms["ind_hc_past"] = stem3 .. '셨어'
		honforms["ind_hyc"] = stem3 .. '세요'
		honforms["ind_hyc_alt"] = stem3 .. '셔요'
		honforms["ind_hyc_past"] = stem3 .. '셨어요'
		honforms["ind_hsc"] = stem3 .. '십니다'
		honforms["ind_hsc_past"] = stem3 .. '셨습니다'
		honforms["interrog_hrc"] = stem3 .. '시냐'
		honforms["interrog_hrc_past"] = stem3 .. '셨냐'
		honforms["interrog_hc"] = stem3 .. '셔'
		honforms["interrog_hc_past"] = stem3 .. '셨어'
		honforms["interrog_hyc"] = stem3 .. '세요'
		honforms["interrog_hyc_alt"] = stem3 .. '셔요'
		honforms["interrog_hyc_past"] = stem3 .. '셨어요'
		honforms["interrog_hsc"] = stem3 .. '십니까'
		honforms["interrog_hsc_past"] = stem3 .. '셨습니까'
		honforms["assert_hrc"] = stem3 .. '시겠다'
		honforms["assert_hc"] = stem3 .. '시겠어'
		honforms["assert_hyc"] = stem3 .. '시겠어요'
		honforms["assert_hsc"] = stem3 .. '시겠습니다'
		honforms["cause_hrc"] = stem3 .. '셔'
		honforms["cause_hc"] = stem3 .. '셔서'
		honforms["cause_hyc"] = stem3 .. '시니'
		honforms["cause_hsc"] = stem3 .. '시니까'
		honforms["contrast_hrc"] = stem3 .. '시지만'
		honforms["contrast_hc"] = stem3 .. '신데'
		honforms["contrast_hyc"] = stem3 .. '시더니'
		honforms["conjunction"] = stem3 .. '시고'
		honforms["condition_hrc"] = stem3 .. '시면'
		honforms["condition_hc"] = stem3 .. '셔야'
		honforms["vn_um"] = stem3 .. '심'
		honforms["vn_gi"] = stem3 .. '시기'
		honforms["vn_um_past"] = stem3 .. '셨음'
		honforms["vn_gi_past"] = stem3 .. '셨기'
		honforms["determ_pres"] = stem3 .. '신'
		honforms["determ_fut"] = stem3 .. '실' 
		
		for honkey, honform in pairs(honforms) do
			honforms[honkey] = ('<span class="Kore", lang="ko">' .. honform ..
				'</span> <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(honform, stem1, phonetic) or honform) .. ')</span>')
		end
		
		honorific = [=[
		
{| width="100%" style="background:#F0F0F0"
|- 
|colspan="100%" align="center" style="background:#C0C0C0" |'''Sentence-final forms with honorific''']=] .. honorific_note .. [=[

|- align="left" style="background:#E0E0E0"
|
|Plain ([[해라체]])
|Informal ([[해체]])
|Polite ([[해요체]])
|Formal ([[하십시오체]])
|- align="left"
|
;indicative:
|]=] .. honforms["ind_hrc"] .. [=[<br>''past'': ]=] .. honforms["ind_hrc_past"] .. [=[

|]=] .. honforms["ind_hc"] .. [=[<br>''past'': ]=] .. honforms["ind_hc_past"] .. [=[

|]=] .. honforms["ind_hyc"] .. [=[ ''or'' ]=] .. honforms["ind_hyc_alt"] .. [=[<br>''past'': ]=] .. honforms["ind_hyc_past"] .. [=[

|]=] .. honforms["ind_hsc"] .. [=[<br>''past'': ]=] .. honforms["ind_hsc_past"] .. [=[

|- align="left"
|
;interrogative: 
|]=] .. honforms["interrog_hrc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hrc_past"] .. [=[

|]=] .. honforms["interrog_hc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hc_past"] .. [=[

|]=] .. honforms["interrog_hyc"] .. [=[ ''or'' ]=] .. honforms["interrog_hyc_alt"] .. [=[<br>''past'': ]=] .. honforms["interrog_hyc_past"] .. [=[

|]=] .. honforms["interrog_hsc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hsc_past"] .. [=[

|- align="left"
|
; assertive:
|]=] .. honforms["assert_hrc"] .. [=[||]=] .. honforms["assert_hc"] .. [=[||]=] .. honforms["assert_hyc"] .. [=[||]=] .. honforms["assert_hsc"] .. [=[

|-
|colspan="100%" align="center" style="background:#C0C0C0" |'''Connective forms with honorific'''
|- align="left" 
|
; cause or reason:
|]=] .. honforms["cause_hrc"] .. [=[||]=] .. honforms["cause_hc"] .. [=[||]=] .. honforms["cause_hyc"] .. [=[||]=] .. honforms["cause_hsc"] .. [=[

|- align="left" 
|
; contrast:
|]=] .. honforms["contrast_hrc"] .. [=[||]=] .. honforms["contrast_hc"] .. [=[||]=] .. honforms["contrast_hyc"] .. [=[||
; conjunction:
]=] .. honforms["conjunction"] .. [=[

|- align="left" valign="top"
|
; condition: 
|]=] .. honforms["condition_hrc"] .. [=[||]=] .. honforms["condition_hc"] .. [=[|| ||

|- 
|colspan="100%" align="center" style="background:#C0C0C0" |'''Noun and determiner forms with honorific'''
|- align="left"
|style="background:#E0E0E0" colspan="2"| Verbal nouns
|]=] .. honforms["vn_um"] .. [=[||]=] .. honforms["vn_gi"] .. [=[|| 

|- align="left"
|style="background:#E0E0E0"  colspan="2"| Past-tense verbal nouns
|]=] .. honforms["vn_um_past"] .. [=[||]=] .. honforms["vn_gi_past"] .. [=[|| 

|- align="left"
| style="background:#E0E0E0" colspan="2"| Determiners
|
|''present'' ]=] .. honforms["determ_pres"] .. [=[||''future'' ]=] .. honforms["determ_fut"] .. [=[

|}]=]
	else
		if honorific_note == '' then
			honorific = "''This verb is not usually used with an honorific.''"
		else
			honorific = honorific_note
		end
	end
	
	stems = [=[

{| align=left style="margin-left:0.5em; margin-bottom:0.5em; border:1px solid #AAAAAA; width:30em; border-collapse:collapse; text-align:center" cellpadding="5" rules="all"
|-
!colspan=2 style="background-color:#FAF0E6"|Stems
|-
!style="background-color:#FAF0E6"|''Stem 1''
|style="background-color:#FFF0F5"|]=] .. stem1 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic or stem1) .. [=[)</span>

|-
!style="background-color:#FAF0E6"|''Stem 2''
|style="background-color:#FFF0F5"|]=] .. stem2 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem2, stem1, phonetic) or stem2) .. [=[)</span>]=]

	if stem2a ~= '' then
		stems = stems .. [=[

|-
!style="background-color:#FAF0E6"|''Stem 2a''
|style="background-color:#FFF0F5"|]=] .. stem2a .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem2a, stem1, phonetic) or stem2a) .. [=[)</span>]=]
	end
	
	stems = stems .. [=[

|-
!style="background-color:#FAF0E6"|''Stem 3''
|style="background-color:#FFF0F5"|]=] .. stem3 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem3, stem1, phonetic) or stem3) .. ')</span>'

	local conj_type = {
		['ha'] = { ['name'] = "[[:Category:Korean ha-irregular adjectives|하<span style=\"color:#888\">(ha)</span>-irregular]]", ['category'] = "[[Category:Korean ha-irregular adjectives]]" },
		['reu'] = { ['name'] = "[[:Category:Korean reu-irregular adjectives|르<span style=\"color:#888\">(reu)</span>-irregular]]", ['category'] = "[[Category:Korean reu-irregular adjectives]]" },
		['reo'] = { ['name'] = "[[:Category:Korean reo-irregular adjectives|러<span style=\"color:#888\">(reo)</span>-irregular]]", ['category'] = "[[Category:Korean reo-irregular adjectives]]" },
		['s'] = { ['name'] = "[[:Category:Korean s-irregular adjectives|ㅅ<span style=\"color:#888\">(s)</span>-irregular]]", ['category'] = "[[Category:Korean s-irregular adjectives]]" },
		['p'] = { ['name'] = "[[:Category:Korean p-irregular adjectives|ㅂ<span style=\"color:#888\">(p)</span>-irregular]]", ['category'] = "[[Category:Korean p-irregular adjectives]]" },
		['h'] = { ['name'] = "[[:Category:Korean h-irregular adjectives|ㅎ<span style=\"color:#888\">(h)</span>-irregular]]", ['category'] = "[[Category:Korean h-irregular adjectives]]" },
		['det-h'] = { ['name'] = "[[:Category:Korean determiner-h-irregular adjectives|ㅎ<span style=\"color:#888\">(h)</span>-determiner irregular]]", ['category'] = "[[Category:Korean determiner-h-irregular adjectives]]" },
		['l'] = { ['name'] = "[[:Category:Korean l-irregular adjectives|ㄹ<span style=\"color:#888\">(l)</span>-irregular]]", ['category'] = "[[Category:Korean l-irregular adjectives]]" },
		['si'] = { ['name'] = "[[:Category:Korean si-irregular adjectives|시<span style=\"color:#888\">(si)</span>-irregular]]", ['category'] = "[[Category:Korean si-irregular adjectives]]" },
		['ex'] = { ['name'] = "[[:Category:Korean existential-irregular adjectives|있없<span style=\"color:#888\">(iss/eops)</span>-irregular]]", ['category'] = "[[Category:Korean existential-irregular adjectives]]" },
		[''] = { ['name'] = "regular", ['category'] = "" },
	}
	if consonant_stem then
		stem_type = "Consonant-stem, "
	else
		stem_type = "Vowel-stem, "
	end

	conjugation_type = [=[

|-
!style="background-color:#FAF0E6"|Conjugation type
|style="background-color:#FFF0F5"|]=] .. stem_type .. conj_type[irregtype]['name']

	if mw.title.getCurrentTitle().nsText == '' then
		conjugation_type = conjugation_type .. conj_type[irregtype]['category']
	end
	
	return [=[
<div class="NavFrame">
<div class="NavHead" align="left">&nbsp; &nbsp; Selected forms of the adjective ]=] .. forms["lemma"] .. [=[</div>
<div class="NavContent">
]=] .. stems .. conjugation_type .. [=[

|}<br clear="all"/>
{| width="100%" valign="bottom" style="background:#F0F0F0"
|-
|colspan="100%" align="center" style="background:#C0C0C0" |'''Sentence-final forms'''
|- align="left" style="background:#E0E0E0" 
|
|Formal non polite<br />([[해라체]])
|Informal non polite<br />([[해체]])
|Informal polite<br />([[해요체]])
|Formal polite<br />([[하십시오체]])
|- align="left" valign="top"
|
;indicative: 
|]=] .. forms["ind_hrc"] .. [=[<br>''past'': ]=] .. forms["ind_hrc_past"] .. [=[

|]=] .. forms["ind_hc"] .. [=[<br>''past'': ]=] .. forms["ind_hc_past"] .. [=[

|]=] .. forms["ind_hyc"] .. [=[<br>''past'': ]=] .. forms["ind_hyc_past"] .. [=[

|]=] .. forms["ind_hssoc"] .. [=[<br>''past'': ]=] .. forms["ind_hssoc_past"] .. [=[

|- align="left"
|
;interrogative:
|]=] .. forms["interrog_hrc"] .. [=[<br>''past'': ]=] .. forms["interrog_hrc_past"] .. [=[

|]=] .. forms["interrog_hc"] .. [=[<br>''past'': ]=] .. forms["interrog_hc_past"] .. [=[

|]=] .. forms["interrog_hyc"] .. [=[<br>''past'': ]=] .. forms["interrog_hyc_past"] .. [=[

|]=] .. forms["interrog_hssoc"] .. [=[<br>''past'': ]=] .. forms["interrog_hssoc_past"] .. [=[

|- align="left"
|
; assertive:
|]=] .. forms["assert_hrc"] .. [=[||]=] .. forms["assert_hc"] .. [=[||]=] .. forms["assert_hyc"] .. [=[||]=] .. forms["assert_hssoc"] .. [=[

|-
|colspan="100%" align="center"  style="background:#C0C0C0" |'''Connective forms'''
|- align="left"
|
;cause or reason: 
|]=] .. forms["cause_hrc"] .. [=[||]=] .. forms["cause_hc"] .. [=[||]=] .. forms["cause_hyc"] .. [=[||]=] .. forms["cause_hssoc"] .. [=[

|- align="left"
|
;contrast: 
|]=] .. forms["contrast_hrc"] .. [=[||]=] .. forms["contrast_hc"] .. [=[||]=] .. forms["contrast_hyc"] .. [=[||
;conjunction: 
]=] .. forms["conjunction"] .. [=[

|- align="left" valign="top"
|
;condition:  
|]=] .. forms["condition_hrc"] .. [=[||]=] .. forms["condition_hc"] .. [=[|| || ||
|- align="left"
|colspan="100%" align="center" style="background:#C0C0C0" |'''Noun and determiner forms'''
|- align="left"
| style="background:#E0E0E0" colspan="2"|Verbal nouns
|]=] .. forms["vn_um"] .. [=[||]=] .. forms["vn_gi"] .. [=[|| 

|- align="left"
| style="background:#E0E0E0" colspan="2"|Past-tense verbal nouns
|]=] .. forms["vn_um_past"] .. [=[||]=] .. forms["vn_gi_past"] .. [=[|| 

|- align="left"
| style="background:#E0E0E0" colspan="2"|Determiners
|
|''present'' ]=] .. forms["determ_pres"] .. [=[||''future'' ]=] .. forms["determ_fut"] .. [=[

|}

]=] .. honorific .. [=[</div></div>]=]
end

function export.verb(frame)
	local word = frame.args[1] or mw.title.getCurrentTitle()
	local irreg = frame.args["irreg"] or ''
	local reg = frame.args["reg"] or 'no'
	local north = frame.args["north"] or ''
	local hortative = frame.args["hortative"] or ''
	local imperative = frame.args["imperative"] or ''
	local honimperative = frame.args["imperative"] or ''
	local phonetic = (frame.args["phon"] and frame.args["phon"] ~= "") and mw.ustring.sub(frame.args["phon"], 1, -2) or false
	local honorific = frame.args["honorific"] or 'yes'
	local honorific_note = frame.args["honorific_note"] or ''
	local form = frame.args["form"] or ''
	local forms = {}
	local honforms = {}
	local irregtype = ''
	local stem1,stem1a,stem2,stem2a,stem2b,stem3,haet,hayeot,ham,han,hal,hap,irregtype='','','','','','','','','','','','',''
	local consonant_stem = true
	
	stem1 = mw.ustring.sub(word,1,-2)
	prestem1 = mw.ustring.sub(stem1,1,-2)
	stem1last_basic = mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1))
	stem1last = stem1last_basic - 0xAC00
	stem1_jongseong = stem1last % 28
	if stem1_jongseong == 0 then
		stem1_jongseong = ''
	else
		stem1_jongseong = mw.ustring.char(0x11A7 + stem1_jongseong)
	end
	
	stem1_jungseong = math.floor((stem1last % 588) / 28)
	stem1_jungseong = mw.ustring.char(0x1161 + stem1_jungseong)
	
	if stem1_jongseong == '' then
		consonant_stem = false
		hal = prestem1 .. mw.ustring.char(stem1last_basic + 8)
		ham = prestem1 .. mw.ustring.char(stem1last_basic + 16)
		han = prestem1 .. mw.ustring.char(stem1last_basic + 4)
		hap = prestem1 .. mw.ustring.char(stem1last_basic + 17)
		if stem1_jungseong == 'ᅡ' then
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 54616 then
				irregtype = 'ha'
				stem2 = prestem1 .. mw.ustring.char(stem1last_basic + 28)
				haet = prestem1 .. '했'
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				haet = prestem1 .. mw.ustring.char(stem1last_basic + 20)
				if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 44032 then
					if reg == 'no' then
						irregtype = 'ga'
						stem2a = stem1 .. '거'
						stem2b = '가오'
					end
				end
			end
		elseif stem1_jungseong == 'ᅵ' then
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 392)
			haet = prestem1 .. mw.ustring.char(stem1last_basic - 372)
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 49884 then
				if irreg == 'y' then
					irregtype = 'si'
					hortative = 'no'
					honorific = 'no'
					stem2a = prestem1 .. '세'
					honorific_note = "''This verb is in honorific form.''"
				end
			end
			if irregtype ~= 'si' then
				nsdiff = 'y'
				if north == 'y' then
					stem2a = stem1 .. '여'
					hayeot = stem1 .. '였'
				else
					stem2a = stem1 .. '어'
					hayeot = stem1 .. '었'
				end
			end
		elseif mw.ustring.match(stem1_jungseong,'[ᅢᅦ]') then
			nsdiff = 'y'
			haet = prestem1 .. mw.ustring.char(stem1last_basic + 20)
			if north == 'y' then
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				stem2a = stem1 .. '어'
				hayeot = stem1 .. '었'
			end
		elseif stem1_jungseong == 'ᅩ' then
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic + 28)
			haet = prestem1 .. mw.ustring.char(stem1last_basic + 48)
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 50724 then
				if reg == 'no' then
					irregtype = 'o'
					stem2a = stem1 .. '너'
					stem2b = '가오'
				else
					stem2a = stem1 .. '아'
					hayeot = stem1 .. '았'
				end
			else
				stem2a = stem1 .. '아'
				hayeot = stem1 .. '았'
			end
		elseif stem1_jungseong == 'ᅬ' then
			nsdiff = 'y'
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 28)
			haet = prestem1 .. mw.ustring.char(stem1last_basic - 8)
			if north == 'y' then
				stem2a = stem1 .. '여'
				hayeot = stem1 .. '였'
			else
				stem2a = stem1 .. '어'
				hayeot = stem1 .. '었'
			end
		elseif stem1_jungseong == 'ᅳ' then
			if mw.ustring.codepoint(mw.ustring.sub(stem1,-1,-1)) == 47476 then
				if mw.ustring.gsub(mw.ustring.sub(stem1,-2,-1),'따르','') == '' then
					stem2 = prestem1 .. '라'
					haet = prestem1 .. '랐'
				elseif mw.ustring.gsub(mw.ustring.sub(stem1,-2,-1),'이르','') == '' and irreg ~= '' then
					irregtype = 'reo'
					stem2 = stem1 .. '러'
					haet = stem1 .. '렀'
				else
					irregtype = 'reu'
					antepenultimate = mw.ustring.sub(prestem1,1,-2)
					penultimate = mw.ustring.codepoint(mw.ustring.sub(prestem1,-1,-1))
					penultimate_vowel = mw.ustring.char(0x1161 + math.floor(((penultimate - 0xAC00) % 588) / 28))
					if mw.ustring.match(penultimate_vowel,'[ᅡᅩ]') then
						stem2 = antepenultimate .. mw.ustring.char(penultimate + 8) .. '라'
						haet = antepenultimate .. mw.ustring.char(penultimate + 8) .. '랐'
					else
						stem2 = antepenultimate .. mw.ustring.char(penultimate + 8) .. '러'
						haet = antepenultimate .. mw.ustring.char(penultimate + 8) .. '렀'
					end
				end
			else
				if mw.ustring.len(stem1) ~= 1 then
					penultimate = mw.ustring.codepoint(mw.ustring.sub(prestem1,-1,-1))
					penultimate_vowel = mw.ustring.char(0x1161 + math.floor(((penultimate - 0xAC00) % 588) / 28))
				else
					penultimate_vowel = 'ᅥ'
				end
				if mw.ustring.match(penultimate_vowel,'[ᅡᅩ]') then
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 504)
					haet = prestem1 .. mw.ustring.char(stem1last_basic - 484)
				else
					stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 392)
					haet = prestem1 .. mw.ustring.char(stem1last_basic - 372)
				end
			end
		elseif stem1_jungseong == 'ᅮ' then
			if irreg == 'y' then
				irregtype = 'u'
				stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 252)
				haet = prestem1 .. mw.ustring.char(stem1last_basic - 232)
			elseif mw.ustring.sub(stem1,-1,-1) == '우' then
				stem2 = prestem1 .. '워'
				haet = prestem1 .. '웠'
			else
				stem2 = stem1 .. '어'
				haet = stem1 .. '었'
				stem2a = prestem1 .. mw.ustring.char(stem1last_basic + 28)
				hayeot = prestem1 .. mw.ustring.char(stem1last_basic + 48)
			end
		elseif stem1_jungseong == 'ᅥ' and irreg == 'y' then
			irregtype = 'eo'
			stem2 = prestem1 .. mw.ustring.char(stem1last_basic - 84)
			haet = prestem1 .. mw.ustring.char(stem1last_basic - 64)
		else
			nsdiff = 'y'
			if north == 'y' then
				stem2 = stem1 .. '여'
				haet = stem1 .. '였'
			else
				stem2 = stem1 .. '어'
				haet = stem1 .. '었'
			end
		end
	else
		if irreg == 'y' then
			if stem1_jongseong == 'ᆺ' then
				cstem = 'y'
				irregtype = 's'
				de_s = mw.ustring.char(stem1last_basic - 19)
				stem3 = prestem1 .. de_s .. '으'
				ham = prestem1 .. de_s .. '음'
				hal = prestem1 .. de_s .. '을'
				han = prestem1 .. de_s .. '은'
				hap = prestem1 .. de_s .. '읍'
				if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
					stem2 = prestem1 .. de_s .. '아'
					haet = prestem1 .. de_s .. '았'
				else
					stem2 = prestem1 .. de_s .. '어'
					haet = prestem1 .. de_s .. '었'
				end
			elseif stem1_jongseong == 'ᆸ' then
				cstem = 'y'
				irregtype = 'p'
				de_p = mw.ustring.char(stem1last_basic - 17)
				stem3 = prestem1 .. de_p .. '우'
				ham = prestem1 .. de_p .. '움'
				hal = prestem1 .. de_p .. '울'
				han = prestem1 .. de_p .. '운'
				if mw.ustring.len(stem1) == 1 then
					if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
						stem2 = prestem1 .. de_p .. '와'
						haet = prestem1 .. de_p .. '왔'
					else
						stem2 = prestem1 .. de_p .. '워'
						haet = prestem1 .. de_p .. '웠'
					end
				else
					nsdiff = 'y'
					if north == 'y' then
						if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
							stem2 = prestem1 .. de_p .. '와'
							haet = prestem1 .. de_p .. '왔'
						else
							stem2 = prestem1 .. de_p .. '워'
							haet = prestem1 .. de_p .. '웠'
						end
					else
						stem2 = prestem1 .. de_p .. '워'
						haet = prestem1 .. de_p .. '웠'
					end
				end
			elseif stem1_jongseong == 'ᆮ' then
				irregtype = 'd'
				cstem = 'y'
				d_to_r = mw.ustring.char(stem1last_basic + 1)
				hal = prestem1 .. d_to_r .. '을'
				ham = prestem1 .. d_to_r .. '음'
				han = prestem1 .. d_to_r .. '은'
				hap = prestem1 .. d_to_r .. '읍'
				stem3 = prestem1 .. d_to_r .. '으'
				if  mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
					stem2 = prestem1 .. d_to_r .. '아'
					haet = prestem1 .. d_to_r .. '았'
				else
					stem2 = prestem1 .. d_to_r .. '어'
					haet = prestem1 .. d_to_r .. '었'
				end
			else
				return error("Irregular irregtype unrecognised.")
			end
		elseif stem1_jongseong == 'ᆯ' then
			irregtype = 'l'
			cstem = 'n'
			stem3 = prestem1 .. mw.ustring.char(stem1last_basic - 8)
			ham = prestem1 .. mw.ustring.char(stem1last_basic + 2)
			hal = stem1
			han = prestem1 .. mw.ustring.char(stem1last_basic - 4)
			hap = prestem1 .. mw.ustring.char(stem1last_basic + 9)
			if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
				stem2 = stem1 .. '아'
			else
				stem2 = stem1 .. '어'
			end
		else
			cstem = 'y'
			stem3 = stem1 .. '으'
			if mw.ustring.match(stem1_jungseong,'[ᅡᅩ]') then
				stem2 = stem1 .. '아'
				if mw.ustring.sub(stem1, -1, -1) == '놓' then
					irregtype = 'noh'
					stem2a = mw.ustring.gsub(stem1, '놓', '놔')
				end
			else
				stem2 = stem1 .. '어'
			end
		end
	end
	if haet == '' then
		if stem2 == (stem1 .. '어') then
			haet = stem1 .. '었'
		elseif stem2 == (stem1 .. '아') then
			haet = stem1 .. '았'
		end
	end
	if stem2 == '' then
		stem2 = stem1
	end
	if stem3 == '' then
		stem3 = stem1
	end
	if han == '' then
		han = stem1 .. '은'
	end
	if ham == '' then
		ham = stem1 .. '음'
	end
	if hal == '' then
		hal = stem1 .. '을'
	end
	if hap == '' then
		hap = stem1 .. '읍'
	end
	if stem1a == '' then
		stem1a = stem1
	end
	
	if form == 'hae' then
		return stem2
	elseif form == 'hae2' then
		if stem2b ~= '' then
			return ''
		else
			return stem2a
		end
	elseif form == 'hani' then
		return stem3 .. '니'
	end
	
	forms["lemma"] = stem1 .. '다'
	forms["ind_hrc_past"] = haet .. '다'
	forms["ind_hc"] = stem2
	forms["ind_hc_past"] = haet .. '어'
	forms["ind_hyc"] = stem2 .. '요'
	forms["ind_hyc_alt"] = ''
	forms["ind_hyc_past"] = haet .. '어요'
	forms["ind_hssoc_past"] = haet .. '습니다'
	forms["interrog_hrc"] = stem1a .. '느냐'
	forms["interrog_hrc_past"] = haet .. '느냐'
	forms["interrog_hc"] = stem2
	forms["interrog_hc_past"] = haet .. '어'
	forms["interrog_hyc"] = stem2 .. '요'
	forms["interrog_hyc_alt"] = ''
	forms["interrog_hyc_past"] = haet .. '어요'
	forms["interrog_hssoc_past"] = haet .. '습니까'
	forms["assert_hrc"] = stem1 .. '겠다'
	forms["assert_hc"] = stem1 .. '겠어'
	forms["assert_hyc"] = stem1 .. '겠어요'
	forms["assert_hssoc"] = stem1 .. '겠습니다'
	forms["cause_hrc"] = stem2
	forms["cause_hc"] = stem2 .. '서'
	forms["cause_hc_alt"] = ''
	forms["cause_hyc"] = stem3 .. '니'
	forms["cause_hssoc"] = stem3 .. '니까'
	forms["contrast_hrc"] = stem1 .. '지만'
	forms["contrast_hc"] = stem1a .. '는데'
	forms["contrast_hyc"] = stem1 .. '더니'
	forms["conjunction"] = stem1 .. '고'
	forms["condition_hc"] = stem2 .. '야'
	forms["condition_hc_alt"] = ''
	forms["vn_um"] = ham
	forms["vn_gi"] = stem1 .. '기'
	forms["vn_um_past"] = haet .. '음'
	forms["vn_um_past_alt"] = ''
	forms["vn_gi_past"] = haet .. '기'
	forms["vn_gi_past_alt"] = ''
	forms["determ_past"] = han
	forms["determ_pres"] = stem1a .. '는'
	forms["determ_fut"] = hal
	
	if cstem == 'y' then
		forms["ind_hrc"] = stem1 .. '는다'
		forms["ind_hssoc"] = stem1 .. '습니다'
		forms["interrog_hssoc"] = stem1 .. '습니까'
	else
		forms["ind_hrc"] = han .. '다'
		forms["ind_hssoc"] = hap .. '니다'
		forms["interrog_hssoc"] = hap .. '니까'
	end
	if irregtype ~= 'ha' then
		if stem2b == '' then
			if stem2a ~= '' then
				forms["ind_hyc_alt"] = stem2a .. '요'
				forms["interrog_hyc_alt"] = stem2a .. '요'
			end
		end
	end
	if stem2a ~= '' then
		if stem2b == '' and irregtype ~= 'si' then
			forms["cause_hc_alt"] = stem2a .. '서'
			forms["condition_hc_alt"] = stem2a .. '야'
		end
	end
	if stem1 == hal then
		forms["condition_hrc"] = stem1 .. '면'
		forms["motive"] = stem1 .. '려고'
	else
		forms["condition_hrc"] = stem3 .. '면'
		forms["motive"] = stem3 .. '려고'
	end
	if hayeot ~= '' then
		forms["vn_um_past_alt"] = hayeot .. '음'
		forms["vn_gi_past_alt"] = hayeot .. '기'
	end
		
	if hortative ~= 'no' then
		forms["hortative_hrc"] = stem1 .. '자'
		forms["hortative_hc"] = stem2
		forms["hortative_hyc"] = stem2 .. '요'
		forms["hortative_hyc_alt"] = ''
		if irregtype ~= 'ha' then
			if stem2b == '' then
				if stem2a ~= '' then
					forms["hortative_hyc_alt"] = stem2a .. '요'
				end
			end
		end
		forms["hortative_hssoc"] = hap .. '시다'
	end
	if imperative ~= 'no' then
		forms["imperative_hrc"] = ''
		forms["imperative_hrc_alt"] = ''
		forms["imperative_hc"] = ''
		if irregtype ~= 'si' then
			if stem2b ~= '' then
				forms["imperative_hrc"] = stem2a .. '라'
				forms["imperative_hrc_alt"] = stem2 .. '라'
			else
				forms["imperative_hrc"] = stem2 .. '라'
				if stem2a ~= '' then
					forms["imperative_hrc_alt"] = stem2a .. '라'
				end
			end
		end
		if irregtype ~= 'si' then
			forms["imperative_hc"] = stem2
		end
		forms["imperative_hyc"] = stem2 .. '요'
		forms["imperative_hyc_alt"] = ''
		if irregtype ~= 'ha' then
			if stem2b == '' then
				if stem2a ~= '' then
					forms["imperative_hyc_alt"] = stem2a .. '요'
				end
			end
		end
		forms["imperative_hssoc"] = hap .. '시오'
	end
		
	for key, form in pairs(forms) do
		if forms[key] ~= '' then
			forms[key] = ('<span class="Kore", lang="ko">' .. form ..
				'</span> <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(form, stem1, phonetic) or form) .. ')</span>')
		end
	end
	
	if forms["ind_hyc_alt"] ~= '' then
		if irregtype == 'si' then
			forms["ind_hyc"] = forms["ind_hyc_alt"] .. " ''or'' " .. forms["ind_hyc"]
		else
			forms["ind_hyc"] = forms["ind_hyc"] .. " ''or'' " .. forms["ind_hyc_alt"]
		end
	end

	if forms["interrog_hyc_alt"] ~= '' then
		if irregtype == 'si' then
			forms["interrog_hyc"] = forms["interrog_hyc_alt"] .. " ''or'' " .. forms["interrog_hyc"]
		else
			forms["interrog_hyc"] = forms["interrog_hyc"] .. " ''or'' " .. forms["interrog_hyc_alt"]
		end
	end
	
	if hortative ~= 'no' then
		if forms["hortative_hyc_alt"] ~= '' then
			forms["hortative_hyc"] = forms["hortative_hyc"] .. " ''or'' " .. forms["hortative_hyc_alt"]
		end
	end
	
	if imperative ~= 'no' then
		if forms["imperative_hrc_alt"] ~= '' then
			forms["imperative_hrc"] = forms["imperative_hrc"] .. " ''or'' " .. forms["imperative_hrc_alt"]
		end
	
		if forms["imperative_hyc_alt"] ~= '' then
			if irregtype == 'si' then
				forms["imperative_hyc"] = forms["imperative_hyc_alt"] .. " ''or'' " .. forms["imperative_hyc"]
			else
				forms["imperative_hyc"] = forms["imperative_hyc"] .. " ''or'' " .. forms["imperative_hyc_alt"]
			end
		end
	end

	if forms["cause_hc_alt"] ~= '' then
		forms["cause_hc"] = forms["cause_hc"] .. " ''or'' " .. forms["cause_hc_alt"]
	end

	if forms["condition_hc_alt"] ~= '' then
		forms["condition_hc"] = forms["condition_hc"] .. " ''or'' " .. forms["condition_hc_alt"]
	end

	if forms["vn_um_past_alt"] ~= '' then
		forms["vn_um_past"] = forms["vn_um_past"] .. " ''or'' " .. forms["vn_um_past_alt"]
	end

	if forms["vn_gi_past_alt"] ~= '' then
		forms["vn_gi_past"] = forms["vn_gi_past"] .. " ''or'' " .. forms["vn_gi_past_alt"]
	end

	if hortative ~= 'no' then
		hortative = [=[
|- align="left"
|
;hortative: 
|]=] .. forms["hortative_hrc"] .. [=[||]=] .. forms["hortative_hc"] .. [=[||]=] .. forms["hortative_hyc"] .. [=[||]=] .. forms["hortative_hssoc"] .. [=[
]=]
	else
		hortative = ''
	end

	if imperative ~= 'no' then
		imperative = [=[
|- align="left"
|
;imperative: 
|]=] .. forms["imperative_hrc"] .. [=[||]=] .. forms["imperative_hc"] .. [=[||]=] .. forms["imperative_hyc"] .. [=[||]=] .. forms["imperative_hssoc"] .. [=[
]=]
	else
		imperative = ''
	end

	if honorific ~= 'no' then
		honforms["ind_hrc"] = stem3 .. '신다'
		honforms["ind_hrc_past"] = stem3 .. '셨다'
		honforms["ind_hc"] = stem3 .. '셔'
		honforms["ind_hc_past"] = stem3 .. '셨어'
		honforms["ind_hyc"] = stem3 .. '세요'
		honforms["ind_hyc_alt"] = stem3 .. '셔요'
		honforms["ind_hyc_past"] = stem3 .. '셨어요'
		honforms["ind_hsc"] = stem3 .. '십니다'
		honforms["ind_hsc_past"] = stem3 .. '셨습니다'
		honforms["interrog_hrc"] = stem3 .. '시느냐'
		honforms["interrog_hrc_past"] = stem3 .. '셨느냐'
		honforms["interrog_hc"] = stem3 .. '셔'
		honforms["interrog_hc_past"] = stem3 .. '셨어'
		honforms["interrog_hyc"] = stem3 .. '세요'
		honforms["interrog_hyc_alt"] = stem3 .. '셔요'
		honforms["interrog_hyc_past"] = stem3 .. '셨어요'
		honforms["interrog_hsc"] = stem3 .. '십니까'
		honforms["interrog_hsc_past"] = stem3 .. '셨습니까'
		honforms["assert_hrc"] = stem3 .. '시겠다'
		honforms["assert_hc"] = stem3 .. '시겠어'
		honforms["assert_hyc"] = stem3 .. '시겠어요'
		honforms["assert_hsc"] = stem3 .. '시겠습니다'
		honforms["cause_hrc"] = stem3 .. '셔'
		honforms["cause_hc"] = stem3 .. '셔서'
		honforms["cause_hyc"] = stem3 .. '시니'
		honforms["cause_hsc"] = stem3 .. '시니까'
		honforms["contrast_hrc"] = stem3 .. '시지만'
		honforms["contrast_hc"] = stem3 .. '시는데'
		honforms["contrast_hyc"] = stem3 .. '시더니'
		honforms["conjunction"] = stem3 .. '시고'
		honforms["condition_hrc"] = stem3 .. '시면'
		honforms["condition_hc"] = stem3 .. '셔야'
		honforms["motive"] = stem3 .. '시려고'
		honforms["vn_um"] = stem3 .. '심'
		honforms["vn_gi"] = stem3 .. '시기'
		honforms["vn_um_past"] = stem3 .. '셨음'
		honforms["vn_gi_past"] = stem3 .. '셨기'
		honforms["determ_past"] = stem3 .. '신'
		honforms["determ_pres"] = stem3 .. '시는'
		honforms["determ_fut"] = stem3 .. '실'
		
		if honimperative ~= 'no' then
			honforms["imperative_hrc"] = stem3 .. '시라'
			honforms["imperative_hc"] = stem3 .. '셔'
			honforms["imperative_hyc"] = stem3 .. '세요'
			honforms["imperative_hyc_alt"] = stem3 .. '셔요'
			honforms["imperative_hsc"] = stem3 .. '십시오'
		end
		
		for honkey, honform in pairs(honforms) do
			if honforms[honkey] ~= '' then
				honforms[honkey] = ('<span class="Kore", lang="ko">' .. honform ..
					'</span> <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(honform, stem1, phonetic) or honform) .. ')</span>')
			end
		end
		honforms["ind_hyc"] = honforms["ind_hyc"] .. " ''or'' " .. honforms["ind_hyc_alt"]
		honforms["interrog_hyc"] = honforms["interrog_hyc"] .. " ''or'' " .. honforms["interrog_hyc_alt"]
		
		if honimperative ~= 'no' then	
			honimperative = [=[
|- align="left"
|  |
;imperative: 
|]=] .. honforms["imperative_hrc"] .. [=[||]=] .. honforms["imperative_hc"] .. [=[||]=] .. honforms["imperative_hyc"] .. [=[||]=] .. honforms["imperative_hsc"] .. [=[

]=]
		else
			honimperative = ''
		end
		
		honorific = [=[
{| width="100%" style="background:#F0F0F0"
|- 
|colspan="100%" align="center" style="background:#C0C0C0" |'''Sentence-final forms with honorific''']=] .. honorific_note .. [=[

|- align="left" style="background:#E0E0E0"
|
|Formal non polite<br />([[해라체]])
|Informal non polite<br />([[해체]])
|Informal polite<br />([[해요체]])
|Formal polite<br />([[하십시오체]])
|- align="left"
|
;indicative:
|]=] .. honforms["ind_hrc"] .. [=[<br>''past'': ]=] .. honforms["ind_hrc_past"] .. [=[

|]=] .. honforms["ind_hc"] .. [=[<br>''past'': ]=] .. honforms["ind_hc_past"] .. [=[

|]=] .. honforms["ind_hyc"] .. [=[<br>''past'': ]=] .. honforms["ind_hyc_past"] .. [=[

|]=] .. honforms["ind_hsc"] .. [=[<br>''past'': ]=] .. honforms["ind_hsc_past"] .. [=[

|- align="left"
|
;interrogative: 
|]=] .. honforms["interrog_hrc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hrc_past"] .. [=[

|]=] .. honforms["interrog_hc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hc_past"] .. [=[

|]=] .. honforms["interrog_hyc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hyc_past"] .. [=[

|]=] .. honforms["interrog_hsc"] .. [=[<br>''past'': ]=] .. honforms["interrog_hsc_past"] .. [=[

]=] .. honimperative .. [=[

|- align="left"
|
; assertive:
|]=] .. honforms["assert_hrc"] .. [=[||]=] .. honforms["assert_hc"] .. [=[||]=] .. honforms["assert_hyc"] .. [=[||]=] .. honforms["assert_hsc"] .. [=[

|-
|colspan="100%" align="center" style="background:#C0C0C0" |'''Connective honforms with honorific'''
|- align="left" 
|
; cause or reason:
|]=] .. honforms["cause_hrc"] .. [=[||]=] .. honforms["cause_hc"] .. [=[||]=] .. honforms["cause_hyc"] .. [=[||]=] .. honforms["cause_hsc"] .. [=[

|- align="left" 
|
; contrast:
|]=] .. honforms["contrast_hrc"] .. [=[||]=] .. honforms["contrast_hc"] .. [=[||]=] .. honforms["contrast_hyc"] .. [=[||

; conjunction:]=]
.. honforms["conjunction"] .. [=[

|- align="left" valign="top"
|
; condition: 
|]=] .. honforms["condition_hrc"] .. [=[||]=] .. honforms["condition_hc"] .. [=[|| || 

; motive: ]=]
.. honforms["motive"] .. [=[

|- 
|colspan="100%" align="center" style="background:#C0C0C0" |'''Noun and determiner honforms with honorific'''
|- align="left"
|style="background:#E0E0E0" colspan="2"| Verbal nouns
|]=] .. honforms["vn_um"] .. [=[||]=] .. honforms["vn_gi"] .. [=[|| 

|- align="left"
|style="background:#E0E0E0"  colspan="2"| Past-tense verbal nouns
|]=] .. honforms["vn_um_past"] .. [=[||]=] .. honforms["vn_gi_past"] .. [=[||

|- align="left"
| style="background:#E0E0E0" colspan="2"| Determiners
|''past'' ]=] .. honforms["determ_past"] .. [=[||''present'' ]=] .. honforms["determ_pres"] .. [=[||''future'' ]=] .. honforms["determ_fut"] .. [=[

|}]=]
	else
		if honorific_note == '' then
			honorific = "''This verb is not usually used with an honorific.''"
		else
			honorific = honorific_note
		end
	end
	stems = [=[

{| align=left style="margin-left:0.5em; margin-bottom:0.5em; border:1px solid #AAAAAA; width:30em; border-collapse:collapse; text-align:center" cellpadding="5" rules="all"
|-
!colspan=2 style="background-color:#FAF0E6"|Stems
|-
!style="background-color:#FAF0E6"|''Stem 1''
|style="background-color:#FFF0F5"|]=] .. stem1 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic or stem1) .. [=[)</span>
|-
!style="background-color:#FAF0E6"|''Stem 2''
|style="background-color:#FFF0F5"|]=] .. stem2 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem2, stem1, phonetic) or stem2) .. [=[)</span>]=]

	if stem2a ~= '' then
		stems = stems .. [=[

|-
!style="background-color:#FAF0E6"|''Stem 2a''
|style="background-color:#FFF0F5"|]=] .. stem2a .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem2a, stem1, phonetic) or stem2a) .. [=[)</span>]=]
	end

	stems = stems .. [=[

|-
!style="background-color:#FAF0E6"|''Stem 3''
|style="background-color:#FFF0F5"|]=] .. stem3 .. ' <span style="color:#888">(' .. m_translit.tr_revised(phonetic and mw.ustring.gsub(stem3, stem1, phonetic) or stem3) .. ')</span>'

	local conj_type = {
		['ha'] = { ['name'] = "[[:Category:Korean ha-irregular verbs|하<span style=\"color:#888\">(ha)</span>-irregular]]", ['category'] = "[[Category:Korean ha-irregular verbs]]" },
		['ga'] = { ['name'] = "[[:Category:Korean ga-irregular verbs|가<span style=\"color:#888\">(ga)</span>-irregular]]", ['category'] = "[[Category:Korean ga-irregular verbs]]" },
		['si'] = { ['name'] = "[[:Category:Korean si-irregular verbs|시<span style=\"color:#888\">(si)</span>-irregular]]", ['category'] = "[[Category:Korean si-irregular verbs]]" },
		['o'] = { ['name'] = "[[:Category:Korean o-irregular verbs|오<span style=\"color:#888\">(o)</span>-irregular]]", ['category'] = "[[Category:Korean o-irregular verbs]]" },
		['reu'] = { ['name'] = "[[:Category:Korean reu-irregular verbs|르<span style=\"color:#888\">(reu)</span>-irregular]]", ['category'] = "[[Category:Korean reu-irregular verbs]]" },
		['reo'] = { ['name'] = "[[:Category:Korean reo-irregular verbs|러<span style=\"color:#888\">(reo)</span>-irregular]]", ['category'] = "[[Category:Korean reo-irregular verbs]]" },
		['s'] = { ['name'] = "[[:Category:Korean s-irregular verbs|ㅅ<span style=\"color:#888\">(s)</span>-irregular]]", ['category'] = "[[Category:Korean s-irregular verbs]]" },
		['p'] = { ['name'] = "[[:Category:Korean p-irregular verbs|ㅂ<span style=\"color:#888\">(p)</span>-irregular]]", ['category'] = "[[Category:Korean p-irregular verbs]]" },
		['noh'] = { ['name'] = "[[:Category:Korean noh-irregular verbs|놓<span style=\"color:#888\">(noh)</span>-irregular]]", ['category'] = "[[Category:Korean noh-irregular verbs]]" },
		['l'] = { ['name'] = "[[:Category:Korean l-irregular verbs|ㄹ<span style=\"color:#888\">(l)</span>-irregular]]", ['category'] = "[[Category:Korean l-irregular verbs]]" },
		['d'] = { ['name'] = "[[:Category:Korean d-irregular verbs|ㄷ<span style=\"color:#888\">(l)</span>-irregular]]", ['category'] = "[[Category:Korean d-irregular verbs]]" },
		['eo'] = { ['name'] = "[[:Category:Korean eo-irregular verbs|어<span style=\"color:#888\">(eo)</span>-irregular]]", ['category'] = "[[Category:Korean eo-irregular verbs]]" },
		['u'] = { ['name'] = "[[:Category:Korean u-irregular verbs|우<span style=\"color:#888\">(u)</span>-irregular]]", ['category'] = "[[Category:Korean u-irregular verbs]]" },
		[''] = { ['name'] = "regular", ['category'] = "" },
	}
	if consonant_stem then
		stem_type = "Consonant-stem, "
	else
		stem_type = "Vowel-stem, "
	end
	
	conjugation_type = [=[

|-
!style="background-color:#FAF0E6"|Conjugation type
|style="background-color:#FFF0F5"|]=] .. stem_type .. conj_type[irregtype]['name']

	if mw.title.getCurrentTitle().nsText == '' then
		conjugation_type = conjugation_type .. conj_type[irregtype]['category']
	end
	
	return [=[
<div class="NavFrame">
<div class="NavHead" align="left">&nbsp; &nbsp; Selected forms of the verb ]=] .. forms["lemma"] .. [=[</div>
<div class="NavContent">
]=] .. stems .. conjugation_type .. [=[

|}<br clear="all"/>
{| width="100%" valign="bottom" style="background:#F0F0F0"
|-
|colspan="100%" align="center" style="background:#C0C0C0" |'''Sentence-final forms'''
|- align="left" style="background:#E0E0E0" 
|
|Formal non polite<br />([[해라체]])
|Informal non polite<br />([[해체]])
|Informal polite<br />([[해요체]])
|Formal polite<br />([[하십시오체]])
|- align="left" valign="top"
|
;indicative: 
|]=] .. forms["ind_hrc"] .. [=[<br>''past'': ]=] .. forms["ind_hrc_past"] .. [=[

|]=] .. forms["ind_hc"] .. [=[<br>''past'': ]=] .. forms["ind_hc_past"] .. [=[

|]=] .. forms["ind_hyc"] .. [=[<br>''past'': ]=] .. forms["ind_hyc_past"] .. [=[

|]=] .. forms["ind_hssoc"] .. [=[<br>''past'': ]=] .. forms["ind_hssoc_past"] .. [=[

|- align="left"
|
;interrogative:
|]=] .. forms["interrog_hrc"] .. [=[<br>''past'': ]=] .. forms["interrog_hrc_past"] .. [=[

|]=] .. forms["interrog_hc"] .. [=[<br>''past'': ]=] .. forms["interrog_hc_past"] .. [=[

|]=] .. forms["interrog_hyc"] .. [=[<br>''past'': ]=] .. forms["interrog_hyc_past"] .. [=[

|]=] .. forms["interrog_hssoc"] .. [=[<br>''past'': ]=] .. forms["interrog_hssoc_past"] .. [=[

]=] .. hortative .. [=[

]=] .. imperative .. [=[

|- align="left"
|
; assertive:
|]=] .. forms["assert_hrc"] .. [=[||]=] .. forms["assert_hc"] .. [=[||]=] .. forms["assert_hyc"] .. [=[||]=] .. forms["assert_hssoc"] .. [=[

|-
|colspan="100%" align="center"  style="background:#C0C0C0" |'''Connective forms'''
|- align="left"
|
;cause or reason: 
|]=] .. forms["cause_hrc"] .. [=[||]=] .. forms["cause_hc"] .. [=[||]=] .. forms["cause_hyc"] .. [=[||]=] .. forms["cause_hssoc"] .. [=[

|- align="left"
|
;contrast: 
|]=] .. forms["contrast_hrc"] .. [=[||]=] .. forms["contrast_hc"] .. [=[||]=] .. forms["contrast_hyc"] .. [=[

|
;conjunction: 
]=] .. forms["conjunction"] .. [=[

|- align="left" valign="top"
|
;condition:
|]=] .. forms["condition_hrc"] .. [=[||]=] .. forms["condition_hc"] .. [=[|| ||

;motive: 
]=] .. forms["motive"] .. [=[

|- align="left"
|colspan="100%" align="center" style="background:#C0C0C0" |'''Noun and determiner forms'''
|- align="left"
| style="background:#E0E0E0" colspan="2"|Verbal nouns
|]=] .. forms["vn_um"] .. [=[||]=] .. forms["vn_gi"] .. [=[|| || 

|- align="left"
| style="background:#E0E0E0" colspan="2"|Past-tense verbal nouns
|]=] .. forms["vn_um_past"] .. [=[||]=] .. forms["vn_gi_past"] .. [=[|| 

|- align="left"
| style="background:#E0E0E0" colspan="2"|Determiners
|''past'' ]=] .. forms["determ_past"] .. [=[||''present'' ]=] .. forms["determ_pres"] .. [=[||''future'' ]=] .. forms["determ_fut"] .. [=[

|}

]=] .. honorific .. [=[

</div></div>]=]
end

return export