Module:ja-conj

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

Description

This module is invoked by {{ja-conj-ex}}.


local export = {}
local m_ja = require("Module:ja")
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("ja")

local romaji = require("Module:Hrkt-translit").tr
local ja_shift = require("Module:ja-shift").shift
local ja_onbin = require("Module:ja-shift").onbin

local ugsub = require("Module:string utilities").gsub

function export.jaconj(frame)
	
	local params = {
		 = {}, -- Stem. For irregular verbs: "suru", "kuru", etc.
		 = {}, -- For godan: final kana, for ichidan: "ichi"
		 = {},
		 = {type = "boolean", default = nil}, -- For exceptions like 問う, 請う and 恋う
		 = {type = "boolean", default = nil}, -- For exceptions like なさる
		 = {type = "boolean", default = nil}, -- For irregular single-kanji suru verbs
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local data = {rows = {"dic", "pas", "cau", "pot", "per", "con", "hyp", "vol", "imp", "cps", "rpt", "des", "pro"}, forms = {}, cascade= {}, entry = {}}
	
	local head = args or mw.title.getCurrentTitle().text
	
	if head == "ja-conj-ex" then
		args = "もや"
		args = "す"
		head = "燃やす"
	end
	
	local sk = args == true and true or false
	
	local headstem = head:sub(1, -4) -- Remove last kana
	if args == nil then error("Parameter 1= is not set.") end
	if args == nil then
		if args ~= "suru" and args ~= "する" and args ~= "kuru" and args ~= "くる" and args ~= "来る" then error("Parameter 2= is not set. It can only be left blank if parameter 1= is 'suru' or 'kuru'.") end
	elseif args ~= "ichi" and args ~= "i" then
		if (string.len(args:gsub("", "")) > 0) and (string.len(args:gsub("", "A")) == 1) and args ~= "suru" and args ~= "する" and args ~= "zuru" and args ~= "ずる" and args ~= "kuru" and args ~= "くる" and args ~= "来る" then error("Parameter 2= must consist of a single hiragana character, if not 'ichi/i', 'suru/する', 'zuru/ずる' or 'kuru/くる/来る'.") end
	end
	
	args = args:gsub("_", " ")
	
	local grade = args == "i" and "ichi" or args
	grade = args == nil and args or grade -- Irregular verbs
	
	grade = grade == "する" and "suru" or grade
	grade = (grade == "来る" or grade == "くる") and "kuru" or grade
	
	-- Suru-tsu verbs (check if final character of stem is "っ")
	if args == "suru" or args == "する" and args:sub(-3, -1) == "っ" then
		grade = "suru-tsu"
		if head:sub(-6, -1) == "する" then
			headstem = head:sub(1, -7) -- Remove 'する' if already present
		else
			headstem = head
		end
	-- Single-kanji suru verbs
	elseif (args == true and (args == "suru" or args == "する")) or ((args == "suru" or args == "する") and head:sub(-6, -1) == "する" and head:sub(1, -7):sub(1, -4) == "") and ugsub(head:sub(1, -7), "", "") ~= "" then
		headstem = head:sub(1, -7)
		grade = ""
		sk = true
	-- Zuru verbs
	elseif (args == "zuru" or args == "ずる") and head:sub(-6, -1) == "ずる" then
		headstem = head:sub(1, -7)
		grade = "zuru"
	-- Noun + suru verbs
	elseif args == "suru" or args == "する" then
		grade = "suru"
		if head:sub(-6, -1) == "する" then
			headstem = head:sub(1, -7) .. " " -- Remove 'する' if already present
			head = head:sub(1, -7) .. " する"
		else
			headstem = head .. " "
			head = head .. " する"
		end
	-- ? + kuru verbs
	elseif args == "kuru" or args == "来る" or args == "くる" then
		grade = "kuru"
		if head:sub(-6, -1) == "来る" or head:sub(-6, -1) == "くる" then
			headstem = head:sub(1, -7) -- Remove '来る' if already present
			head = head:sub(1, -7) .. " 来る"
		else
			error("Missing「来る」in head= or page name.")
		end
	end
	
	local headkanji = headstem:gsub(" ", "")
	local headkanjikana = args
	
	if (string.len(args:gsub("", "")) > 0) and args ~= "suru" and args ~= "kuru" and args ~= "来る" then error("Parameter 1= must consist of hiragana or katakana characters only, if it is not set to 'suru' or 'kuru'.") end
	
	if string.len(headkanji:gsub("", "")) == 0 and string.len(args:gsub("", "")) == 0 and args ~= nil then if args .. args ~= head then error("Hiragana readings for 1= and 2= do not correspond to head= or the page title.") end end
	
	if string.len(headkanji:gsub("", "")) > 0 then
		
		local savedkana = {}
		for _, character in ipairs(splitByKana(args:gsub(".", ""))) do
		    headkanji = string.gsub(headkanji, character, function(kana)
		    	table.insert(savedkana, kana)
		    	return ""
		    end)
		end
		
		for _, character in ipairs(savedkana) do
			headkanjikana = headkanjikana:gsub(character, "")
		end -- Isolate kanji
	
	end
	
	local ou = (head == "問う" or head == "請う" or head == "恋う" or args == true) and true or false
	local honorific_verbs = {"いらっしゃる", "おっしゃる", "くださる", "ござる", "なさる"}
	local hv = (contains(honorific_verbs, args .. grade) or args == true) and true or false
	
	sk = args == false and false or sk
	ou = args == false and false or ou
	hv = args == false and false or hv
	
	for key, row in pairs(data.rows) do
		
		data.forms = autoConjugate(args, args, row, grade, headstem, head, ou, hv, sk)
		for ckey, crow in pairs(data.forms) do data.cascade = crow end
		
	end
	
	return export.make_table(data, headstem, headkanji, headkanjikana, args, head, grade, ou, hv, sk)
	
end

function export.make_table(data, headstem, headkanji, headkanjikana, args, head, grade, ou, hv, sk)
	
	local result = {}

	local content = [=[
{| class="inflection-table vsSwitcher wikitable" style="margin: 0; margin-top: 2px; text-align: center; width: 100%; border-top: 0" rules="all"
! class="vsToggleElement" colspan="3" style="font-size:97.5%; background-color: var(--wikt-palette-magenta-3, #eaecf0); text-align:left; padding: 2px 2px 2px 10px" | Extended conjugation of@ROMA "<span class="Jpan" lang="ja-Jpan">@HEADWORD</span>"@ANNOTATION
|- class="vsHide"
! colspan="3" style="padding: 12px 0 12px 0; @FONTSIZE" | (See ] and ])
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | ] ("continuative form")
| colspan="2" style="padding: @PADDING; @FONTSIZE" | {dic.mas}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | ] ("attributive form")
| colspan="2" style="padding: @PADDING" | {dic.pln}
|- class="vsHide"
! style="width: 30%" |
! style="width: 35%; padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="width: 35%; padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Conjunctive (''te''-form)
| style="padding: @PADDING" | {con.pln}
| style="padding: @PADDING" | {con.neg}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Non-past <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Imperfective
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {dic.pln}
| style="padding: @PADDING" | {dic.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {dic.pol}
| style="padding: @PADDING" | {dic.png}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Past <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Perfective
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {per.pln}
| style="padding: @PADDING" | {per.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {per.pol}
| style="padding: @PADDING" | {per.png}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Passive
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Verb stem
| colspan="2" style="padding: @PADDING" | {pas.mas}
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {pas.pln}
| style="padding: @PADDING" | {pas.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {pas.pol}
| style="padding: @PADDING" | {pas.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {pas.per}
| style="padding: @PADDING" | {pas.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {pas.ppr}
| style="padding: @PADDING" | {pas.ppn}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Causative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Verb stem
| colspan="2" style="padding: @PADDING" | {cau.mas}
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {cau.pln}<br>''short form:'' {cau.srt}
| style="padding: @PADDING" | {cau.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {cau.pol}
| style="padding: @PADDING" | {cau.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {cau.per}
| style="padding: @PADDING" | {cau.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {cau.ppr}
| style="padding: @PADDING" | {cau.ppn}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Potential
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Verb stem
| colspan="2" style="padding: @PADDING" | {pot.mas}
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {pot.pln}
| style="padding: @PADDING" | {pot.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {pot.pol} 
| style="padding: @PADDING" | {pot.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {pot.per}
| style="padding: @PADDING" | {pot.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {pot.ppr}
| style="padding: @PADDING" | {pot.ppn}
@RANUKI
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Imperative
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | ] <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Firm instruction
| style="padding: @PADDING" | @IMPERATIVE
| style="padding: @PADDING" | —
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Other imperative constructions
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite request
| style="padding: @PADDING" | {imp.kud}
| style="padding: @PADDING" | {imp.nkd}
@NASAI
! style="padding: @PADDING; @FONTSIZE" | Prohibitive <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Do not 〜
| style="padding: @PADDING" | —
| style="padding: @PADDING" | {imp.neg}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Volitional <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Presumptive
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {vol.pln}
| style="padding: @PADDING" | —
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {vol.pol}
| style="padding: @PADDING" | —
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Conditional
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Hypothetical <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Provisional
| style="padding: @PADDING" | {hyp.pln}
| style="padding: @PADDING" | {hyp.neg}<br>''colloquial:'' {hyp.ngc}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | ] form
| style="padding: @PADDING" | {hyp.tar}
| style="padding: @PADDING" | {hyp.nta}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Causative passive
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Verb stem
| colspan="2" style="padding: @PADDING" | @CAUSATIVEPASSIVESTEM
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {cps.pln}
| style="padding: @PADDING" | {cps.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {cps.pol}
| style="padding: @PADDING" | {cps.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {cps.per}
| style="padding: @PADDING" | {cps.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {cps.ppr}
| style="padding: @PADDING" | {cps.ppn}
|- class="vsHide"
! colspan="3" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Desiderative (] form)
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {des.pln}
| style="padding: @PADDING" | {des.neg}
|- class="vsHide"
!
| colspan="2" style="padding: 12px 10px 12px 10px; @FONTSIZE" | For other desiderative forms, see ].
|- class="vsHide"
! colspan="3" style="padding: 10px 0px 10px 0; @BACKGROUND1; @FONTSIZE" | Progressive action and current state (] form)
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {pro.pln}@PROGRESSIVECONTRACTIONS {pro.srt}
| style="padding: @PADDING" | {pro.neg}@PROGRESSIVECONTRACTIONS {pro.pst}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {pro.pol}
| style="padding: @PADDING" | {pro.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {pro.per}
| style="padding: @PADDING" | {pro.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {pro.ppr}
| style="padding: @PADDING" | {pro.ppn}
|- class="vsHide"
| colspan="3" style="padding: 0" |
{|class="inflection-table wikitable" style="margin: 0; text-align: center; min-width: 100%; border-top: 0; border-style: hidden" rules="all"
|-
! colspan="2" style="padding: 10px 0 10px 0; @BACKGROUND1; @FONTSIZE" | Other forms and constructions
@ARCHAICNEGATIVES
! style="padding: @PADDING; width: 50%; @FONTSIZE" | Negative continuative
| style="padding: @PADDING" rowspan="2" | {dic.fng}
|-
! style="padding: @PADDING; @FONTSIZE" | (〜<span class="Jpan" lang="ja-Jpan">]</span>): without 〜ing
|-
! style="padding: @PADDING; @FONTSIZE" | Representative <span class="Jpan" lang="ja-Jpan" style="font-size: 95%">/</span> Listing examples
| style="padding: @PADDING" | {dic.exa}
|-
| colspan="2" style="padding: 12px 10px 12px 15px; background-color: var(--background-color-interactive); @FONTSIZE; text-align: left" | @FOOTNOTES
|}
|}]=]

	local imperativeForms = (grade == "ichi" or grade == "suru" or grade == "suru-tsu" or grade == "zuru") and "''written:'' {imp.wri},<br>''spoken:'' {imp.spo}" or "{imp.pln}"
	if sk == true then imperativeForms = "{imp.pln},<br>''written:'' {imp.wri}<br>''spoken:'' {imp.spo}" end
	local annotation = ] "pentagrade")]=]
	if grade == "ichi" and romaji(args:sub(-3), 'jp'):sub(-1) == "i" then
		annotation = ] "upper monograde")]=]
	elseif grade == "ichi" and romaji(args:sub(-3), 'jp'):sub(-1) == "e" then
		annotation = ] "lower monograde")]=]
	elseif grade == "kuru" then
		annotation = ] "''k''-irregular")]=]
	elseif grade == "suru" then
		annotation = ] "''s''-irregular")]=]
	elseif grade == "suru-tsu" then
		annotation = ] "''s''-irregular", special single-kanji <span class="Jpan" lang="ja-Jpan">-っする</span> class)]=]
	elseif grade == "zuru" then
		annotation = ] "''s''-irregular" + ] "upper monograde", special single-kanji <span class="Jpan" lang="ja-Jpan">-ずる/-じる</span> class)]=]
	elseif sk == true then
		annotation = ] "''s''-irregular" + ] "pentagrade", special single-kanji <span class="Jpan" lang="ja-Jpan">-する</span> class)]=]
	elseif head == "行く" and args == "い" then
		annotation = ] "pentagrade", irregular euphonic form: ''iku'' → ''itta'', ''itte'')]=]
	elseif hv == true then
		annotation = ] "pentagrade", special honorific class: <span class="Jpan" lang="ja-Jpan">]=] .. args .. args .. '</span> → <span class="Jpan" lang="ja-Jpan">' .. args .. 'い' .. '</span>)'
	elseif ou == true then
		annotation = ] "pentagrade", irregular euphonic form: ''-ou'' → ''-outa'', ''-oute'')]=]
	end
	
	if grade == "ichi" then
		content = content:gsub("@RANUKI", [=[
|- class="vsHide"
! colspan="3" style="padding: 12px 0 12px 0; @BACKGROUND1; @FONTSIZE" | Potential with ]
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Verb stem
| colspan="2" style="padding: @PADDING" | {rpt.mas}
|- class="vsHide"
!
! style="padding: 7px 0 7px 0; @FONTSIZE" | Positive
! style="padding: 7px 0 7px 0; @FONTSIZE" | Negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Plain
| style="padding: @PADDING" | {rpt.pln}
| style="padding: @PADDING" | {rpt.neg}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite
| style="padding: @PADDING" | {rpt.pol} 
| style="padding: @PADDING" | {rpt.png}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Past
| style="padding: @PADDING" | {rpt.per}
| style="padding: @PADDING" | {rpt.prn}
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Polite past
| style="padding: @PADDING" | {rpt.ppr}
| style="padding: @PADDING" | {rpt.ppn}
|- class="vsHide"
]=])
	else
		content = content:gsub("@RANUKI", '|- class="vsHide"')
	end
	
	if isGodan(grade) then
		content = content:gsub("@CAUSATIVEPASSIVESTEM", "''standard:'' {cps.mas}<br>''colloquial:'' {cps.mcl}@CAUSATIVEPASSIVESUPERSCRIPT")
	else
		content = content:gsub("@CAUSATIVEPASSIVESTEM", '{cps.mas}')
	end
	
	if grade == "ichi" or grade == "suru" or grade == "kuru" or isGodan(grade) then
		if args == "い" and grade == "う" and headstem == "言" then
			content = content:gsub("@ARCHAICNEGATIVES", [=[
|- class="vsHide"
! style="padding: @PADDING; width: 50%; @FONTSIZE" | Archaic or classical negative
| style="padding: @PADDING" rowspan="2" | {dic.arn}&nbsp;⁴
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Archaic attributive negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Colloquial or dialectal <span class="Jpan" lang="ja-Jpan">-ん</span> negative
| style="padding: @PADDING" | {dic.cln}
|- class="vsHide"
]=])
			content = content:gsub("@CAUSATIVEPASSIVESUPERSCRIPT", '&nbsp;³')
		else
			content = content:gsub("@ARCHAICNEGATIVES", [=[
|- class="vsHide"
! style="padding: @PADDING; width: 50%; @FONTSIZE" | Archaic or classical negative
| style="padding: @PADDING" rowspan="2" | {dic.arn}@ARCHAICSUPERSCRIPT
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Archaic attributive negative
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | Colloquial or dialectal <span class="Jpan" lang="ja-Jpan">-ん</span> negative
| style="padding: @PADDING" | {dic.cln}
|- class="vsHide"
]=])
			if isGodan(grade) then
				content = content:gsub("@CAUSATIVEPASSIVESUPERSCRIPT", '&nbsp;¹')
				content = content:gsub("@ARCHAICSUPERSCRIPT", '&nbsp;²')
			else
				content = content:gsub("@ARCHAICSUPERSCRIPT", '&nbsp;¹')
			end
		end
	else
		content = content:gsub("@ARCHAICNEGATIVES", '|- class="vsHide"')
	end
	
	if ((head == "なさる" or head == "為さる") and hv == true) then
		content = content:gsub("@NASAI", '|- class="vsHide"')
	else
		content = content:gsub("@NASAI", [=[
|- class="vsHide"
! style="padding: @PADDING; @FONTSIZE" | ] form
| style="padding: @PADDING" | {imp.pol}
| style="padding: @PADDING" | —
|- class="vsHide"
]=])
	end
	
	if #data.cascade > 1 then
		content = content:gsub("@PROGRESSIVECONTRACTIONS", "<br><br>''contracted forms:''<br>")
	else
		content = content:gsub("@PROGRESSIVECONTRACTIONS", "<br>''contraction:''")
	end
	
	content = content:gsub("@BACKGROUND1", "background-color: var(--background-color-interactive--hover)")
	
	local fn_causative = ] verbs: <span class="Jpan" lang="ja-Jpan">{cps.epl}</span> → <span class="Jpan" lang="ja-Jpan">{cps.col}</span>.]=]
	local fn_archaic = 'Archaic form, now mostly used in set phrases, written language and formal speech.'
	
	if args == "い" and grade == "う" and headstem == "言" then
		content = content:gsub("@FOOTNOTES", '¹ Informal alternative in conversational speech.<br>² Alternative colloquial form in the Kansai dialect.<br>³ ' .. fn_causative .. '<br>⁴ ' .. fn_archaic)
	else
		if isGodan(grade) then
			content = content:gsub("@FOOTNOTES", '¹ ' .. fn_causative .. '<br>² ' .. fn_archaic)
		else
			content = content:gsub("@FOOTNOTES", '¹ ' .. fn_archaic)
		end
	end
	
	if (grade == "kuru" and headstem == "来") or (grade == "suru" and headstem == "為") or (grade == "kuru" and (args == "来る" or args == "kuru")) or (args == "い" and grade == "う" and headstem == "言") then
		content = content:gsub("@PADDING", '20px 10px 20px 10px')
	else
		content = content:gsub("@PADDING", '10px 10px 10px 10px')
	end
	
	if grade == "suru" and (args == "する" or args == "suru") then
		content = content:gsub("@HEADWORD", headstem:gsub(" ", "") .. "]")
	elseif grade == "kuru" and (args == "来る" or args == "くる" or args == "kuru") then
		content = content:gsub("@HEADWORD", headstem:gsub(" ", "") .. "来る")
	else
		content = content:gsub("@HEADWORD", head)
	end
	
	content = content:gsub("@IMPERATIVE", imperativeForms)
	content = content:gsub("@ANNOTATION", ' (Class:&nbsp;' .. annotation)
	
	content = content:gsub("@FONTSIZE", 'font-size: 97.5%%')
	
	if headstem ~= args and args ~= nil and grade ~= "suru" and grade ~= "kuru" and grade ~= "ichi" then
		content = content:gsub("@ROMA", " ''" .. romaji(args .. args, "jp") .. "''")
	elseif grade == "ichi" then
		content = content:gsub("@ROMA", " ''" .. romaji(args .. "る", "jp") .. "''")
	elseif grade == "kuru" and (args == "来る" or args == "くる" or args == "kuru") then
		content = content:gsub("@ROMA", " ''" .. romaji(args, "jp") .. " " .. romaji("くる", "jp") .. "''")
	elseif grade == "kuru" then
		content = content:gsub("@ROMA", " ''" .. romaji("くる", "jp") .. "''")
	elseif grade == "suru" and (args == "する" or args == "suru") then
		content = content:gsub("@ROMA", " ''" .. romaji(args, "jp") .. " " .. romaji("する", "jp") .. "''")
	elseif grade == "suru" then
		content = content:gsub("@ROMA", " ''" .. romaji("する", "jp") .. "''")
	elseif grade == "suru-tsu" then
		content = content:gsub("@ROMA", " ''" .. romaji(args .. "する", "jp") .. "''")
	else
		content = content:gsub("@ROMA", " ''" .. romaji(head, "jp") .. "''")
	end
	
	table.insert(result, content)

	return (string.gsub(table.concat(result), "{(+)}",
			function(code)
				if data.cascade == nil then error("Form code {" .. code .. "} not defined.") end
				data.entry = map(data.cascade, function(i)
					if code == "cps.col" or code == "cps.epl" then return '<span class="Jpan" lang="ja-Jpan" style="font-size: 95%">' .. i:gsub("-", "") .. '</span>' end
					local translit = ""
					if grade == "suru" and (args ~= "する" and args ~= "suru") then
						translit = romaji(i:gsub("-", ""), 'jp')
					elseif grade == "suru-tsu" then
						translit = romaji(i:gsub("-", ""), 'jp'):gsub(headkanji, romaji(headkanjikana .. "す", 'jp'):sub(1, -3)) -- Less final letters 'su'
					else
						translit = romaji(i:gsub("-", ""), 'jp'):gsub(headkanji, romaji(headkanjikana, 'jp')):gsub(romaji(headstem, 'jp'), romaji(args, 'jp'))
					end
					local iruby = nil
					if (grade == "kuru" and headstem == "来") or (grade == "suru" and headstem == "為") then
						iruby = '<ruby>' .. headstem .. '<rt>' .. i:sub(1, 3) .. '</rt></ruby>' .. i:sub(4) -- Remove first character, + kanji, +ruby
						i = headstem .. i:sub(4) -- Remove first character, + kanji
					elseif grade == "kuru" and (args == "来る" or args == "kuru") then
						local corresponding_kuru_form = autoConjugate("kuru", nil, code:sub(1, 3), "kuru", "来", "来る", false, false, false)
						iruby = headstem .. '<ruby>来<rt>' .. corresponding_kuru_form:sub(1, 3) .. '</rt></ruby>' .. corresponding_kuru_form:sub(4) -- Remove first character, + kanji, +ruby
						i = headstem .. "来" .. corresponding_kuru_form:sub(4) -- Remove first character, + kanji
					elseif args == "い" and grade == "う" and headstem == "言" then
						if i:sub(1, 3) == "言" then
							iruby = '<ruby>言<rt>い</rt></ruby>' .. i:sub(4) -- Remove first character, + kanji, +ruby
						elseif i:sub(1, 3) == "ゆ" then
							iruby = '<ruby>言<rt>ゆ</rt></ruby>' .. i:sub(4) -- Remove first character, + kanji, +ruby
							i = headstem .. i:sub(4) -- Remove first character, + kanji
						end
					end
					local jplinks = {} -- Suffixes and standalone words link to their own pages
					local count = 0
					for w in i:gmatch("(+)") do
						count = count + 1
						if (code ~= "dic.mas" and (w == headstem:gsub(" ", "") or w == data.cascade or (grade == "kuru" and w == headstem:gsub(" ", "") .. "来"))) or ((grade == "suru" and (args == "する" or args == "suru")) and w == headstem:gsub(" ", "")) then -- The stem should not be hyperlinked.
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif (code == "pas.mas" or code == "cau.mas" or code == "pot.mas" or code == "cps.mas") and count == 1 then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "pas" and ((code ~= "pas.mas" and w == data.cascade:gsub("-", "")) or (w == data.cascade .. "られ" or (grade == "zuru" and (w == headstem:gsub(" ", "") .. "ぜられ" or w == headstem:gsub(" ", "") .. "ぜ")) or (sk == true and w == headstem:gsub(" ", "") .. "され") or (grade == "suru-tsu" and (w == headstem:gsub(" ", "") .. "せられ" or w == headstem:gsub(" ", "") .. "され")))) then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "cau" and ((code ~= "cau.mas" and w == data.cascade:gsub("-", "")) or (w == data.cascade .. "させ" or (sk == true and w == headstem:gsub(" ", "") .. "させ") or (grade == "suru-tsu" and w == headstem:gsub(" ", "") .. "させ"))) then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "pot" and ((code ~= "pot.mas" and w == data.cascade:gsub("-", "")) or (w == data.cascade .. "られ" or (grade == "zuru" and (w == headstem:gsub(" ", "") .. "ぜられ" or w == headstem:gsub(" ", "") .. "ぜ")) or (sk == true and w == headstem:gsub(" ", "") .. "せ") or (grade == "suru-tsu" and w == headstem:gsub(" ", "") .. "せられ"))) then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "cps" and ((code ~= "cps.mas" and w == data.cascade:gsub("-", "")) or (w == data.cascade .. "させられ" or (grade == "suru-tsu" and (w == headstem:gsub(" ", "") .. "しさせられ" or w == headstem:gsub(" ", "") .. "させられ")))) then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "rpt" and ((code ~= "rpt.mas" and w == data.cascade:gsub("-", ""))) then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code:sub(1, 3) == "hyp" and (grade == "suru-tsu" and w == headstem:gsub(" ", "") .. "さ") then
							if iruby == nil then table.insert(jplinks, w) else table.insert(jplinks, get_nth(iruby, count)) end
						elseif code == "hyp.neg" or code == "hyp.nta" then
							table.insert(jplinks, w)
						elseif code == "hyp.tar" and count == 1 then
							table.insert(jplinks, w)
						elseif code == "hyp.ngc" and w == headstem .. ja_shift(grade, "a", true) then
							table.insert(jplinks, w)
						elseif code:sub(1, 3) == "cps" and (count > 1 and (code ~= "cps.mas" and w == "させられ")) then
							table.insert(jplinks, w)
						elseif isGodan(grade) and code:sub(1, 3) == "cps" and w == headstem .. ja_shift(grade, "a", true) .. "され" then
							table.insert(jplinks, w)
						elseif w == "て" or w == "ず" then
							table.insert(jplinks, ']')
						elseif w == "に" then
							table.insert(jplinks, ']')
						elseif w == "して" or w == "した" then
							table.insert(jplinks, ']')
						elseif w == "な" then
							table.insert(jplinks, ']')
						elseif w == "させ" and count > 1 then
							table.insert(jplinks, ']')
						elseif w == "られ" and count > 1 then
							table.insert(jplinks, ']')
						elseif w == "れ" and count > 1 and (code == "pas.mas" or code == "pot.mas" or code == "rpt.mas") then
							table.insert(jplinks, ']')
						elseif w == "り" and count > 1 and code == "dic.exa" then
							table.insert(jplinks, ']')
						elseif w == "る" and count > 1 and code == "pro.srt" then
							table.insert(jplinks, ']')
						elseif w =="ない" and count > 1 and code:sub(1, 3) == "pro" then
							table.insert(jplinks, ']')
						elseif w =="ぬ" and count > 1 and code:sub(1, 3) == "dic" then
							table.insert(jplinks, ']')
						elseif w =="ん" and count > 1 and code:sub(1, 3) == "dic" then
							table.insert(jplinks, ']')
						elseif w == "し" and count > 1 and code == "dic.mas" then
							table.insert(jplinks, ']')
						elseif w == "し" and count > 1 then
							table.insert(jplinks, w)
						elseif w == "ら" and count > 1 and code:sub(1, 3) == "hyp" then
							table.insert(jplinks, ']')
						elseif (w =="える" or w =="え") and count > 1 and code:sub(1, 3) == "pot" and (grade == "suru-tsu" or sk == true)  then
							table.insert(jplinks, ']')
						elseif w == "せ" and count > 1 and code == "cau.mas" then
							table.insert(jplinks, ']')
						elseif w == "され" and count > 1 and code:sub(1, 3) == "pas" and grade == "suru" then
							table.insert(jplinks, ']')
						elseif w == "せ" and count > 1 and code == "cps.mas" then
							table.insert(jplinks, ']')
						elseif code == "dic.pln" and w == mw.title.getCurrentTitle().text then
							if iruby == nil then table.insert(jplinks, "'''" .. w .. "'''") else table.insert(jplinks, "'''" .. get_nth(iruby, count) .. "'''") end
						else
							if iruby == nil then
								table.insert(jplinks, ']')
							else
								table.insert(jplinks, ']')
							end
						end
					end
					if code == "dic.fng" and not (args == "い" and grade == "う" and headstem == "言") then
						if isGodan(grade) then
							return '<span class="Jpan" lang="ja-Jpan">' .. table.concat(jplinks) .. '</span> <span style="font-size:95%"></span>&nbsp;²'
						else
							return '<span class="Jpan" lang="ja-Jpan">' .. table.concat(jplinks) .. '</span> <span style="font-size:95%"></span>&nbsp;¹'
						end
					elseif args == "い" and grade == "う" and headstem == "言" then
						if translit:sub(1, 3) == "yut" then
							return =] .. table.concat(jplinks) .. =] .. translit .. </span>&nbsp;¹]=]
						elseif translit:sub(1, 3) == "yū" then
							return =] .. table.concat(jplinks) .. =] .. translit .. </span>&nbsp;²]=]
						elseif code == "dic.fng" then
							return '<span class="Jpan" lang="ja-Jpan">' .. table.concat(jplinks) .. '</span> <span style="font-size:95%"></span>&nbsp;⁴'
						end
					end
					return '<span class="Jpan" lang="ja-Jpan">' .. table.concat(jplinks) .. '</span> <span style="font-size:95%"></span>'
				end)
				return table.concat(data.entry, "<br>")
			end))
	
end

function autoConjugate(stem, args2, row, grade, headstem, head, ou, hv, sk)
	
	local conj = "—"
	
	if args2 == nil then
		headstem = ""
	end
	
	if row == "dic" and ou == true then
		
		conj = {
			pln = { head },
			neg = { headstem .. ja_shift(grade, "a") .. "ない" },
			pol = { headstem .. ja_shift(grade, "i") .. "ます" },
			png = { headstem .. ja_shift(grade, "i") .. "ません" },
			mas = { headstem .. ja_shift(grade, "i") },
			fng = { headstem .. ja_shift(grade, "a") .. "-ず" },
			exa = { headstem .. "う-たり" },
			arn = { headstem .. ja_shift(grade, "a") .. "-ぬ" },
			cln = { headstem .. ja_shift(grade, "a") .. "-ん" },
		}
		
		return conj
		
	elseif row == "dic" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { head },
			neg = { headstem .. ja_shift(grade, "a") .. "ない" },
			pol = { headstem .. ja_shift(grade, "i") .. "ます" },
			png = { headstem .. ja_shift(grade, "i") .. "ません" },
			mas = { headstem .. ja_shift(grade, "i") },
			fng = { headstem .. ja_shift(grade, "a") .. "-ず" },
			exa = { headstem .. ja_onbin(grade, "a") .. "-り", "ゆった-り", "ゆうた-り" },
			arn = { headstem .. ja_shift(grade, "a") .. "-ぬ" },
			cln = { headstem .. ja_shift(grade, "a") .. "-ん" },
		}
	
	elseif row == "dic" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { head },
			neg = { headstem .. ja_shift(grade, "a") .. "ない" },
			pol = { headstem .. ja_shift(grade, "i") .. "ます" },
			png = { headstem .. ja_shift(grade, "i") .. "ません" },
			mas = { headstem .. ja_shift(grade, "i") },
			fng = { headstem .. ja_shift(grade, "a") .. "-ず" },
			exa = { headstem .. "っ-たり" },
			arn = { headstem .. ja_shift(grade, "a") .. "-ぬ" },
			cln = { headstem .. ja_shift(grade, "a") .. "-ん" },
		}
		
		return conj
		
	elseif row == "dic" and hv == true then
		
		conj = {
			pln = { head },
			neg = { headstem .. ja_shift(grade, "a") .. "ない" },
			pol = { headstem .. "います" },
			png = { headstem .. "いません" },
			mas = { headstem .. "い" },
			fng = { headstem .. ja_shift(grade, "a") .. "-ず" },
			exa = { headstem .. ja_onbin(grade, "a") .. "-り" },
			arn = { headstem .. ja_shift(grade, "a") .. "-ぬ" },
			cln = { headstem .. ja_shift(grade, "a") .. "-ん" },
		}
		
		return conj
	
	-- Dictionary / Imperfective / Non-past
	elseif row == "dic" then
		
		if grade == "suru" then return {
			pln = { headstem .. "する" },
			neg = { headstem .. "しない" },
			pol = { headstem .. "し-ます" },
			png = { headstem .. "し-ません" },
			mas = { headstem .. "し" },
			fng = { headstem .. "せず" },
			exa = { headstem .. "し-たり" },
			arn = { headstem .. "せぬ" },
			cln = { headstem .. "せん" },
		} elseif grade == "suru-tsu" then return { 
			pln = { headstem .. "する" },
			neg = { headstem .. "しない" },
			pol = { headstem .. "し-ます" },
			png = { headstem .. "し-ません" },
			mas = { headstem .. "し" },
			fng = { headstem .. "せ-ず", headstem .. "しず" },
			exa = { headstem .. "し-たり" },
			arn = { headstem .. "せ-ぬ" },
			cln = { headstem .. "せ-ん" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "くる" },
			neg = { headstem .. "こない" },
			pol = { headstem .. "き-ます" },
			png = { headstem .. "き-ません" },
			mas = { headstem .. "き" },
			fng = { headstem .. "こ-ず" },
			exa = { headstem .. "き-たり" },
			arn = { headstem .. "こ-ぬ" },
			cln = { headstem .. "こ-ん" },
		} elseif sk == true then return {
			pln = { headstem .. "する" },
			neg = { headstem .. "さない", headstem .. "しない" },
			pol = { headstem .. "し-ます" },
			png = { headstem .. "し-ません" },
			mas = { headstem .. "し" },
			fng = { headstem .. "さ-ず" },
			exa = { headstem .. "し-たり" },
			arn = { headstem .. "さ-ぬ" },
			cln = { headstem .. "さ-ん" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "ずる", headstem .. "じる" },
			neg = { headstem .. "じない" },
			pol = { headstem .. "じ-ます" },
			png = { headstem .. "じ-ません" },
			mas = { headstem .. "じ" },
			fng = { headstem .. "ぜ-ず" },
			exa = { headstem .. "じ-たり" },
			arn = { headstem .. "ぜ-ぬ" },
			cln = { headstem .. "ぜ-ん" },
		} end
		
		conj = grade == "ichi" and {
			pln = { head },
			neg = { headstem .. "ない" },
			pol = { headstem .. "ます" },
			png = { headstem .. "ません" },
			mas = { headstem },
			fng = { headstem .. "-ず" },
			exa = { headstem .. "-たり" },
			arn = { headstem .. "-ぬ" },
			cln = { headstem .. "-ん" },
		} or {
			pln = { head },
			neg = { headstem .. ja_shift(grade, "a") .. "ない" },
			pol = { headstem .. ja_shift(grade, "i") .. "ます" },
			png = { headstem .. ja_shift(grade, "i") .. "ません" },
			mas = { headstem .. ja_shift(grade, "i") },
			fng = { headstem .. ja_shift(grade, "a") .. "-ず" },
			exa = { headstem .. ja_onbin(grade, "a") .. "-り" },
			arn = { headstem .. ja_shift(grade, "a") .. "-ぬ" },
			cln = { headstem .. ja_shift(grade, "a") .. "-ん" },
		}
		
		return conj
		
	-- Passive
	elseif row == "pas" then
		
		if grade == "suru" then return {
			pln = { headstem .. "される" },
			neg = { headstem .. "され-ない" },
			pol = { headstem .. "され-ます" },
			png = { headstem .. "され-ません" },
			mas = { headstem .. "され" },
			per = { headstem .. "され-た" },
			prn = { headstem .. "され-なかった" },
			ppr = { headstem .. "され-ました" },
			ppn = { headstem .. "され-ません でした" },
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "せられる", headstem .. "しられる" },
			neg = { headstem .. "せられ-ない", headstem .. "しられ-ない" },
			pol = { headstem .. "せられ-ます", headstem .. "しられ-ます" },
			png = { headstem .. "せられ-ません", headstem .. "しられ-ません" },
			mas = { headstem .. "せ-られ", headstem .. "しられ" },
			per = { headstem .. "せられ-た", headstem .. "しられ-た" },
			prn = { headstem .. "せられ-なかった", headstem .. "しられ-なかった" },
			ppr = { headstem .. "せられ-ました", headstem .. "しられ-ました" },
			ppn = { headstem .. "せられ-ません でした", headstem .. "しられ-ません でした" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こられる" },
			neg = { headstem .. "こられ-ない" },
			pol = { headstem .. "こられ-ます" },
			png = { headstem .. "こられ-ません" },
			mas = { headstem .. "こ-られ" },
			per = { headstem .. "こられ-た" },
			prn = { headstem .. "こられ-なかった" },
			ppr = { headstem .. "こられ-ました" },
			ppn = { headstem .. "こられ-ません でした" },
		} elseif sk == true then return {
			pln = { headstem .. "される" },
			neg = { headstem .. "され-ない" },
			pol = { headstem .. "され-ます" },
			png = { headstem .. "され-ません" },
			mas = { headstem .. "され" },
			per = { headstem .. "され-た" },
			prn = { headstem .. "され-なかった" },
			ppr = { headstem .. "され-ました" },
			ppn = { headstem .. "され-ません でした" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じられる", headstem .. "ぜられる" },
			neg = { headstem .. "じられ-ない", headstem .. "ぜられ-ない" },
			pol = { headstem .. "じられ-ます", headstem .. "ぜられ-ます" },
			png = { headstem .. "じられ-ません", headstem .. "ぜられ-ません" },
			mas = { headstem .. "じ-られ", headstem .. "ぜ-られ" },
			per = { headstem .. "じられ-た", headstem .. "ぜられ-た" },
			prn = { headstem .. "じられ-なかった", headstem .. "ぜられ-なかった" },
			ppr = { headstem .. "じられ-ました", headstem .. "ぜられ-ました" },
			ppn = { headstem .. "じられ-ません でした", headstem .. "ぜられ-ません でした" },
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "られる" },
			neg = { headstem .. "られ-ない" },
			pol = { headstem .. "られ-ます" },
			png = { headstem .. "られ-ません" },
			mas = { headstem .. "-られ" },
			per = { headstem .. "られ-た" },
			prn = { headstem .. "られ-なかった" },	
			ppr = { headstem .. "られ-ました" },
			ppn = { headstem .. "られ-ません でした" },
		} or {
			pln = { headstem .. ja_shift(grade, "a") .. "れる" },
			neg = { headstem .. ja_shift(grade, "a") .. "れ-ない" },
			pol = { headstem .. ja_shift(grade, "a") .. "れ-ます" },
			png = { headstem .. ja_shift(grade, "a") .. "れ-ません" },
			mas = { headstem .. ja_shift(grade, "a") .. "-れ" },
			per = { headstem .. ja_shift(grade, "a") .. "れ-た" },
			prn = { headstem .. ja_shift(grade, "a") .. "れ-なかった" },
			ppr = { headstem .. ja_shift(grade, "a") .. "れ-ました" },
			ppn = { headstem .. ja_shift(grade, "a") .. "れ-ません でした" },
		}
		
		return conj
		
	-- Causative
	elseif row == "cau" then
		
		if grade == "suru" then return {
			pln = { headstem .. "させる" },
			neg = { headstem .. "させ-ない" },
			pol = { headstem .. "させ-ます" },
			png = { headstem .. "させ-ません" },
			mas = { headstem .. "させ" },
			srt = { headstem .. "さす" },
			per = { headstem .. "させ-た" },
			prn = { headstem .. "させ-なかった" },
			ppr = { headstem .. "させ-ました" },
			ppn = { headstem .. "させ-ません でした" },
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "しさせる" },
			neg = { headstem .. "しさせ-ない" },
			pol = { headstem .. "しさせ-ます" },
			png = { headstem .. "しさせ-ません" },
			mas = { headstem .. "し-させ" },
			srt = { headstem .. "しさす" },
			per = { headstem .. "しさせ-た" },
			prn = { headstem .. "しさせ-なかった" },
			ppr = { headstem .. "しさせ-ました" },
			ppn = { headstem .. "しさせ-ません でした" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こさせる" },
			neg = { headstem .. "こさせ-ない" },
			pol = { headstem .. "こさせ-ます" },
			png = { headstem .. "こさせ-ません" },
			mas = { headstem .. "こ-させ" },
			srt = { headstem .. "こさす" },
			per = { headstem .. "こさせ-た" },
			prn = { headstem .. "こさせ-なかった" },
			ppr = { headstem .. "こさせ-ました" },
			ppn = { headstem .. "こさせ-ません でした" },
		} elseif sk == true then return {
			pln = { headstem .. "させる" },
			neg = { headstem .. "させ-ない" },
			pol = { headstem .. "させ-ます" },
			png = { headstem .. "させ-ません" },
			mas = { headstem .. "させ" },
			srt = { headstem .. "さす" },
			per = { headstem .. "させ-た" },
			prn = { headstem .. "させ-なかった" },
			ppr = { headstem .. "させ-ました" },
			ppn = { headstem .. "させ-ません でした" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じさせる" },
			neg = { headstem .. "じさせ-ない" },
			pol = { headstem .. "じさせ-ます" },
			png = { headstem .. "じさせ-ません" },
			mas = { headstem .. "じ-させ" },
			srt = { headstem .. "じさす" },
			per = { headstem .. "じさせ-た" },
			prn = { headstem .. "じさせ-なかった" },
			ppr = { headstem .. "じさせ-ました" },
			ppn = { headstem .. "じさせ-ません でした" },
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "させる" },
			neg = { headstem .. "させ-ない" },
			pol = { headstem .. "させ-ます" },
			png = { headstem .. "させ-ません" },
			mas = { headstem .. "-させ" },
			srt = { headstem .. "さす" },
			per = { headstem .. "させ-た" },
			prn = { headstem .. "させ-なかった" },
			ppr = { headstem .. "させ-ました" },
			ppn = { headstem .. "させ-ません でした" },
		} or {
			pln = { headstem .. ja_shift(grade, "a") .. "せる" },
			neg = { headstem .. ja_shift(grade, "a") .. "せ-ない" },
			pol = { headstem .. ja_shift(grade, "a") .. "せ-ます" },
			png = { headstem .. ja_shift(grade, "a") .. "せ-ません" },
			mas = { headstem .. ja_shift(grade, "a") .. "-せ" },
			srt = { headstem .. ja_shift(grade, "a") .. "す" },
			per = { headstem .. ja_shift(grade, "a") .. "せ-た" },
			prn = { headstem .. ja_shift(grade, "a") .. "せ-なかった" },
			ppr = { headstem .. ja_shift(grade, "a") .. "せ-ました" },
			ppn = { headstem .. ja_shift(grade, "a") .. "せ-ません でした" },
		}
		
		return conj
		
	-- Potential
	elseif row == "pot" then
		
		if grade == "suru" then return {
			pln = { headstem .. "できる" },
			neg = { headstem .. "できない" },
			pol = { headstem .. "でき-ます" },
			png = { headstem .. "でき-ません" },
			mas = { headstem .. "でき" },
			con = { headstem .. "でき-て" },
			cng = { headstem .. "でき-ない で", "でき-なくて" },
			per = { headstem .. "でき-た" },
			prn = { headstem .. "でき-なかった" },
			ppr = { headstem .. "でき-ました" },
			ppn = { headstem .. "でき-ません でした" },
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "せられる", headstem .. "し-える", headstem .. "しられる" },
			neg = { headstem .. "せられ-ない", headstem .. "し-え-ない", headstem .. "しられ-ない" },
			pol = { headstem .. "せられ-ます", headstem .. "し-え-ます", headstem .. "しられ-ます" },
			png = { headstem .. "せられ-ません", headstem .. "し-え-ません", headstem .. "しられ-ません" },
			mas = { headstem .. "せ-られ", headstem .. "し-え", headstem .. "し-られ-ない" },
			per = { headstem .. "せられ-た", headstem .. "し-え-た", headstem .. "しられ-た" },
			prn = { headstem .. "せられ-なかった", headstem .. "し-え-なかった", headstem .. "しられ-なかった" },
			ppr = { headstem .. "せられ-ました", headstem .. "し-え-ました", headstem .. "しられ-ました" },
			ppn = { headstem .. "せられ-ません でした", headstem .. "し-え-ません でした", headstem .. "しられ-ません でした" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こられる" },
			neg = { headstem .. "こられ-ない" },
			pol = { headstem .. "こられ-ます" },
			png = { headstem .. "こられ-ません" },
			mas = { headstem .. "こ-られ" },
			con = { headstem .. "こられ-て" },
			cng = { headstem .. "こられ-ない で", "こられ-なくて" },
			per = { headstem .. "こられ-た" },
			prn = { headstem .. "こられ-なかった" },
			ppr = { headstem .. "こられ-ました" },
			ppn = { headstem .. "こられ-ません でした" },
		} elseif sk == true then return {
			pln = { headstem .. "せる", headstem .. "し-える" },
			neg = { headstem .. "せ-ない", headstem .. "し-え-ない" },
			pol = { headstem .. "せ-ます", headstem .. "し-え-ます" },
			png = { headstem .. "せ-ません", headstem .. "し-え-ません" },
			mas = { headstem .. "-せ", headstem .. "し-え" },
			per = { headstem .. "せ-た", headstem .. "し-え-た"  },
			prn = { headstem .. "せ-なかった", headstem .. "し-え-なかった" },
			ppr = { headstem .. "せ-ました", headstem .. "し-え-ました" },
			ppn = { headstem .. "せ-ません でした", headstem .. "し-え-ません でした" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じられる", headstem .. "ぜられる" },
			neg = { headstem .. "じられ-ない", headstem .. "ぜられ-ない" },
			pol = { headstem .. "じられ-ます", headstem .. "ぜられ-ます" },
			png = { headstem .. "じられ-ません", headstem .. "ぜられ-ません" },
			mas = { headstem .. "じ-られ", headstem .. "ぜ-られ" },
			per = { headstem .. "じられ-た", headstem .. "ぜられ-た" },
			prn = { headstem .. "じられ-なかった", headstem .. "ぜられ-なかった" },
			ppr = { headstem .. "じられ-ました", headstem .. "ぜられ-ました" },
			ppn = { headstem .. "じられ-ません でした", headstem .. "ぜられ-ません でした" },
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "られる" },
			neg = { headstem .. "られ-ない" },
			pol = { headstem .. "られ-ます" },
			png = { headstem .. "られ-ません" },
			mas = { headstem .. "-られ" },
			per = { headstem .. "られ-た" },
			prn = { headstem .. "られ-なかった" },
			ppr = { headstem .. "られ-ました" },
			ppn = { headstem .. "られ-ません でした" },
		} or {
			pln = { headstem .. ja_shift(grade, "e") .. "る" },
			neg = { headstem .. ja_shift(grade, "e") .. "-ない" },
			pol = { headstem .. ja_shift(grade, "e") .. "-ます" },
			png = { headstem .. ja_shift(grade, "e") .. "-ません" },
			mas = { headstem .. ja_shift(grade, "e")},
			per = { headstem .. ja_shift(grade, "e") .. "-た" },
			prn = { headstem .. ja_shift(grade, "e") .. "-なかった" },
			ppr = { headstem .. ja_shift(grade, "e") .. "-ました" },
			ppn = { headstem .. ja_shift(grade, "e") .. "-ません でした" },
		}
		
		return conj
		
	-- Ranuki potential (ichidan only)
	elseif row == "rpt" then
		
		conj = {
			pln = { headstem .. "れる" },
			neg = { headstem .. "れ-ない" },
			pol = { headstem .. "れ-ます" },
			png = { headstem .. "れ-ません" },
			mas = { headstem .. "-れ" },
			per = { headstem .. "れ-た" },
			prn = { headstem .. "れ-なかった" },
			ppr = { headstem .. "れ-ました" },
			ppn = { headstem .. "れ-ません でした" },
		}
		
		return conj
		
	-- Perfective for exceptions
	elseif row == "per" and ou == true then
		
		conj = {
			pln = { headstem .. "うた" },
			neg = { headstem .. "わ-なかった" },
			pol = { headstem .. "い-ました" },
			png = { headstem .. "い-ません でした" },
		}
		
		return conj
		
	elseif row == "per" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_onbin(grade, "a"), "ゆった", "ゆうた" },
			neg = { headstem .. ja_shift(grade, "a") .. "-なかった" },
			pol = { headstem .. ja_shift(grade, "i") .. "-ました" },
			png = { headstem .. ja_shift(grade, "i") .. "-ません でした" },		
		}
	
	elseif row == "per" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { headstem .. "った" },
			neg = { headstem .. "か-なかった" },
			pol = { headstem .. "き-ました" },
			png = { headstem .. "き-ません でした" },			
		}
		
		return conj
		
	-- Perfective
	elseif row == "per" and ou == false then
		
		if grade == "suru" or grade == "suru-tsu" or sk == true then return {
			pln = { headstem .. "した" },
			neg = { headstem .. "し-なかった" },
			pol = { headstem .. "し-ました" },
			png = { headstem .. "し-ません でした" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "きた" },
			neg = { headstem .. "こ-なかった" },
			pol = { headstem .. "き-ました" },
			png = { headstem .. "き-ません でした" },
		} elseif hv == true then return {
			pln = { headstem .. ja_onbin(grade, "a") },
			neg = { headstem .. ja_shift(grade, "a") .. "-なかった" },
			pol = { headstem .. "い" .. "-ました" },
			png = { headstem .. "い" .. "-ません でした" },			
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じた" },
			neg = { headstem .. "じ-なかった" },
			pol = { headstem .. "じ-ました" },
			png = { headstem .. "じ-ません でした" },			
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "た" },
			neg = { headstem .. "-なかった" },
			pol = { headstem .. "-ました" },
			png = { headstem .. "-ません でした" },
		} or {
			pln = { headstem .. ja_onbin(grade, "a") },
			neg = { headstem .. ja_shift(grade, "a") .. "-なかった" },
			pol = { headstem .. ja_shift(grade, "i") .. "-ました" },
			png = { headstem .. ja_shift(grade, "i") .. "-ません でした" },
		}
		
		return conj
		
	-- -te form for exceptions
	elseif row == "con" and ou == true then
		
		conj = {
			pln = { headstem .. "うて" },
			neg = { headstem .. "わ-ない で", headstem .. "わ-なくて" },
		}
		
		return conj
		
	elseif row == "con" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_onbin(grade, "e"), "ゆって", "ゆうて" },
			neg = { headstem .. ja_shift(grade, "a") .. "ない で", headstem .. ja_shift(grade, "a") .. "-なくて" },		
		}

	elseif row == "con" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { headstem .. "って" },
			neg = { headstem .. "か-ない で", headstem .. "か-なくて" },
		}
		
		return conj
		
	-- -te form
	elseif row == "con" and ou == false then
		
		if grade == "suru" or grade == "suru-tsu" or sk == true then return {
			pln = { headstem .. "して" },
			neg = { headstem .. "しない で", headstem .. "しなくて" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "きて" },
			neg = { headstem .. "こ-ない で", "こ-なくて" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じて" },
			neg = { headstem .. "じない で", headstem .. "じなくて" },	
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "て" },
			neg = { headstem .. "-ない で", headstem .. "-なくて" },
		} or {
			pln = { headstem .. ja_onbin(grade, "e") },
			neg = { headstem .. ja_shift(grade, "a") .. "ない で", headstem .. ja_shift(grade, "a") .. "-なくて" },
		}
		
		return conj
		
	-- Conditional for exceptions
	elseif row == "hyp" and ou == true then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") .. "ば" },
			neg = { headstem .. ja_shift(grade, "a") .. "なければ" },
			ngc = { headstem .. ja_shift(grade, "a") .. "-なきゃ" },
			tar = { headstem .. "う-たら" },
			nta = { headstem .. ja_shift(grade, "a") .. "なかったら" },
		}
		
		return conj
		
	elseif row == "hyp" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") .. "ば" },
			neg = { headstem .. ja_shift(grade, "a") .. "なければ" },
			ngc = { headstem .. ja_shift(grade, "a") .. "-なきゃ" },
			tar = { headstem .. ja_onbin(grade, "a") .. "-ら", "ゆった-ら", "ゆうた-ら" },
			nta = { headstem .. ja_shift(grade, "a") .. "なかったら" },			
		}

	elseif row == "hyp" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") .. "ば" },
			neg = { headstem .. ja_shift(grade, "a") .. "なければ" },
			ngc = { headstem .. ja_shift(grade, "a") .. "-なきゃ" },
			tar = { headstem .. "っ-たら" },
			nta = { headstem .. ja_shift(grade, "a") .. "なかったら" },
		}
		
		return conj
		
	-- Conditional
	elseif row == "hyp" then
		
		if grade == "suru" then return {
			pln = { headstem .. "すれば" },
			neg = { headstem .. "しなければ" },
			ngc = { headstem .. "し-なきゃ" },
			tar = { headstem .. "し-たら" },
			nta = { headstem .. "しなかったら" },
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "すれば" },
			neg = { headstem .. "しなければ" },
			ngc = { headstem .. "し-なきゃ" },
			tar = { headstem .. "し-たら" },
			nta = { headstem .. "しなかったら" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "くれば" },
			neg = { headstem .. "こなければ" },
			ngc = { headstem .. "こ-なきゃ" },
			tar = { headstem .. "き-たら" },
			nta = { headstem .. "こなかったら" },
		} elseif sk == true then return {
			pln = { headstem .. "すれば", headstem .. "せば" },
			neg = { headstem .. "さなければ" },
			ngc = { headstem .. "さ-なきゃ" },
			tar = { headstem .. "し-たら" },
			nta = { headstem .. "しなかったら" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "ずれば" },
			neg = { headstem .. "じなければ" },
			ngc = { headstem .. "じ-なきゃ" },
			tar = { headstem .. "じ-たら" },
			nta = { headstem .. "じなかったら" },
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "れば" },
			neg = { headstem .. "なければ" },
			ngc = { headstem .. "-なきゃ" },
			tar = { headstem .. "-たら" },
			nta = { headstem .. "なかったら" },
		} or {
			pln = { headstem .. ja_shift(grade, "e") .. "ば" },
			neg = { headstem .. ja_shift(grade, "a") .. "なければ" },
			ngc = { headstem .. ja_shift(grade, "a") .. "-なきゃ" },
			tar = { headstem .. ja_onbin(grade, "a") .. "-ら" },
			nta = { headstem .. ja_shift(grade, "a") .. "なかったら" },
		}
		
		return conj
		
	-- Volitional
	elseif row == "vol" then
		
		if grade == "suru" then return {
			pln = { headstem .. "しよう" },
			pol = { headstem .. "し-ましょう" }
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "しよう" },
			pol = { headstem .. "し-ましょう" }
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こよう" },
			pol = { headstem .. "こ-ましょう" },
		} elseif hv == true then return {
			pln = { headstem .. ja_shift(grade, "o") .. "う" },
			pol = { headstem .. "い" .. "-ましょう" }			
		} elseif sk == true then return {
			pln = { headstem .. "そう", headstem .. "-しよう" },
			pol = { headstem .. "し-ましょう" }
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じよう" },
			pol = { headstem .. "じ-ましょう" }
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "よう" },
			pol = { headstem .. "-ましょう" },
		} or {
			pln = { headstem .. ja_shift(grade, "o") .. "う" },
			pol = { headstem .. ja_shift(grade, "i") .. "-ましょう" }
		}
		
		return conj
		
	-- Imperative for exceptions
	elseif row == "imp" and ou == true then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") },
			pol = { headstem .. ja_shift(grade, "i") .. "-なさい" },
			neg = { headstem .. ja_shift(grade, "u") .. " な" },
			kud = { headstem .. "うて ください" },
			nkd = { headstem .. ja_shift(grade, "a") .. "ない で ください" },
		}
		
		return conj
		
	elseif row == "imp" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") },
			pol = { headstem .. ja_shift(grade, "i") .. "-なさい" },
			neg = { headstem .. ja_shift(grade, "u") .. " な" },
			kud = { headstem .. ja_onbin(grade, "e") .. " ください", "ゆって ください", "ゆうて ください" },
			nkd = { headstem .. ja_shift(grade, "a") .. "ない で ください" },
		}

	elseif row == "imp" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_shift(grade, "e") },
			pol = { headstem .. ja_shift(grade, "i") .. "-なさい" },
			neg = { headstem .. ja_shift(grade, "u") .. " な" },
			kud = { headstem .. "って ください" },
			nkd = { headstem .. ja_shift(grade, "a") .. "ない で ください" },
		}
		
		return conj
		
	elseif row == "imp" and hv == true then
		
		conj = {
			pln = { headstem .. "い" },
			pol = { headstem .. "い" .. "-なさい" },
			neg = { headstem .. ja_shift(grade, "u") .. " な" },
			kud = { headstem .. ja_onbin(grade, "e") .. " ください" },
			nkd = { headstem .. ja_shift(grade, "a") .. "ない で ください" },
		}
		
		return conj
	
	-- Imperative
	elseif row == "imp" then
		
		if grade == "suru" or grade == "suru-tsu" then return {
			wri = { headstem .. "せよ" },
			spo = { headstem .. "しろ" },
			pol = { headstem .. "し-なさい" },
			neg = { headstem .. "する な" },
			kud = { headstem .. "して ください" },
			nkd = { headstem .. "しない で ください" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こい" },
			pol = { headstem .. "きなさい" },
			neg = { headstem .. "くる な" },
			kud = { headstem .. "きて ください" },
			nkd = { headstem .. "こない で ください" },
		} elseif sk == true then return {
			pln = { headstem .. "せ" },
			wri = { headstem .. "せよ" },
			spo = { headstem .. "しろ" },
			pol = { headstem .. "し-なさい" },
			neg = { headstem .. "する な" },
			kud = { headstem .. "して ください" },
			nkd = { headstem .. "しない で ください" },
		} elseif grade == "zuru" then return {
			wri = { headstem .. "ぜよ" },
			spo = { headstem .. "じろ" },
			pol = { headstem .. "じ-なさい" },
			neg = { headstem .. "ずる な", headstem .. "じる な" },
			kud = { headstem .. "じて ください" },
			nkd = { headstem .. "じない で ください" },
		} end
		
		conj = grade == "ichi" and {
			wri = { headstem .. "よ" },
			spo = { headstem .. "ろ" },
			pol = { headstem .. "-なさい" },
			neg = { headstem .. "る な" },
			kud = { headstem .. "て ください" },
			nkd = { headstem .. "-ない で ください" },
		} or {
			pln = { headstem .. ja_shift(grade, "e") },
			pol = { headstem .. ja_shift(grade, "i") .. "-なさい" },
			neg = { headstem .. ja_shift(grade, "u") .. " な" },
			kud = { headstem .. ja_onbin(grade, "e") .. " ください" },
			nkd = { headstem .. ja_shift(grade, "a") .. "ない で ください" },
		}
		
		return conj
		
	-- Causative passive
	elseif row == "cps" then
		
		if grade == "suru" then return {
			pln = { headstem .. "させられる" },
			neg = { headstem .. "させられ-ない" },
			pol = { headstem .. "させられ-ます" },
			png = { headstem .. "させられ-ません" },
			mas = { headstem .. "させ-られ" },
			per = { headstem .. "させられ-た" },
			prn = { headstem .. "させられ-なかった" },
			ppr = { headstem .. "させられ-ました" },
			ppn = { headstem .. "させられ-ません でした" },
		} elseif grade == "suru-tsu" then return {
			pln = { headstem .. "しさせられる" },
			neg = { headstem .. "しさせられ-ない" },
			pol = { headstem .. "しさせられ-ます" },
			png = { headstem .. "しさせられ-ません" },
			mas = { headstem .. "し-させ-られ" },
			per = { headstem .. "しさせられ-た" },
			prn = { headstem .. "しさせられ-なかった" },
			ppr = { headstem .. "しさせられ-ました" },
			ppn = { headstem .. "しさせられ-ません でした" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "こさせられる" },
			neg = { headstem .. "こさせられ-ない" },
			pol = { headstem .. "こさせられ-ます" },
			png = { headstem .. "こさせられ-ません" },
			mas = { headstem .. "こ-させ-られ" },
			per = { headstem .. "こさせられ-た" },
			prn = { headstem .. "こさせられ-なかった" },
			ppr = { headstem .. "こさせられ-ました" },
			ppn = { headstem .. "こさせられ-ません でした" },
		} elseif sk == true then return {
			pln = { headstem .. "-させられる" },
			neg = { headstem .. "-させられ-ない" },
			pol = { headstem .. "-させられ-ます" },
			png = { headstem .. "-させられ-ません" },
			mas = { headstem .. "-させ-られ" },
			per = { headstem .. "-させられ-た" },
			prn = { headstem .. "-させられ-なかった" },
			ppr = { headstem .. "-させられ-ました" },
			ppn = { headstem .. "-させられ-ません でした" },
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じさせられる" },
			neg = { headstem .. "じさせられ-ない" },
			pol = { headstem .. "じさせられ-ます" },
			png = { headstem .. "じさせられ-ません" },
			mas = { headstem .. "じ-させ-られ" },
			per = { headstem .. "じさせられ-た" },
			prn = { headstem .. "じさせられ-なかった" },
			ppr = { headstem .. "じさせられ-ました" },
			ppn = { headstem .. "じさせられ-ません でした" },
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "-させられる" },
			neg = { headstem .. "-させられ-ない" },
			pol = { headstem .. "-させられ-ます" },
			png = { headstem .. "-させられ-ません" },
			mas = { headstem .. "-させ-られ" },
			per = { headstem .. "-させられ-た" },
			prn = { headstem .. "-させられ-なかった" },
			ppr = { headstem .. "-させられ-ました" },
			ppn = { headstem .. "-させられ-ません でした" },
		} or {
			pln = { headstem .. ja_shift(grade, "a") .. "せられる" },
			neg = { headstem .. ja_shift(grade, "a") .. "せられ-ない" },
			pol = { headstem .. ja_shift(grade, "a") .. "せられ-ます" },
			png = { headstem .. ja_shift(grade, "a") .. "せられ-ません" },
			mas = { headstem .. ja_shift(grade, "a") .. "-せ-られ" },
			per = { headstem .. ja_shift(grade, "a") .. "せられ-た" },
			prn = { headstem .. ja_shift(grade, "a") .. "せられ-なかった" },
			ppr = { headstem .. ja_shift(grade, "a") .. "せられ-ました" },
			ppn = { headstem .. ja_shift(grade, "a") .. "せられ-ません でした" },
			epl = { headstem .. ja_shift(grade, "a") .. "'''せら'''れる" },
			col = { headstem .. ja_shift(grade, "a") .. "'''さ'''れる" },
		}
		
		if isGodan(grade) then
			conj = {
				pln = { headstem .. ja_shift(grade, "a") .. "せられる", headstem .. ja_shift(grade, "a") .. "される" },
				neg = { headstem .. ja_shift(grade, "a") .. "せられ-ない", headstem .. ja_shift(grade, "a") .. "され-ない" },
				pol = { headstem .. ja_shift(grade, "a") .. "せられ-ます", headstem .. ja_shift(grade, "a") .. "され-ます" },
				png = { headstem .. ja_shift(grade, "a") .. "せられ-ません", headstem .. ja_shift(grade, "a") .. "され-ません" },
				mas = { headstem .. ja_shift(grade, "a") .. "-せ-られ" },
				mcl = { headstem .. ja_shift(grade, "a") .. "され" },
				per = { headstem .. ja_shift(grade, "a") .. "せられ-た", headstem .. ja_shift(grade, "a") .. "され-た" },
				prn = { headstem .. ja_shift(grade, "a") .. "せられ-なかった", headstem .. ja_shift(grade, "a") .. "され-なかった" },
				ppr = { headstem .. ja_shift(grade, "a") .. "せられ-ました", headstem .. ja_shift(grade, "a") .. "され-ました" },
				ppn = { headstem .. ja_shift(grade, "a") .. "せられ-ません でした", headstem .. ja_shift(grade, "a") .. "され-ません でした" },
				epl = { headstem .. ja_shift(grade, "a") .. "'''せら'''れる" },
				col = { headstem .. ja_shift(grade, "a") .. "'''さ'''れる" },
			}
		end
		
		return conj
		
	-- Desiderative
	elseif row == "des" then
		
		if grade == "suru" or grade == "suru-tsu" or sk == true then return {
			pln = { headstem .. "し-たい" },
			neg = { headstem .. "し-たく ない" },
		} elseif grade == "kuru" then return {
			pln = { headstem .. "き-たい" },
			neg = { headstem .. "き-たく ない" },
		} elseif hv == true then return {
			pln = { headstem .. "い-たい" },
			neg = { headstem .. "-いたく ない" },			
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じ-たい" },
			neg = { headstem .. "じ-たく ない" },
		} end
	
		conj = grade == "ichi" and {
			pln = { headstem .. "-たい" },
			neg = { headstem .. "-たく ない" },
		} or {
			pln = { headstem .. ja_shift(grade, "i") .. "-たい" },
			neg = { headstem .. ja_shift(grade, "i") .. "-たく ない" },
		}
		
		return conj
		
	-- -te iru form for exceptions
	elseif row == "pro" and ou == true then
		
		conj = {
			pln = { headstem .. "うて いる" },
			neg = { headstem .. "うて いない" },
			pol = { headstem .. "うて います" },
			png = { headstem .. "うて いません" },
			per = { headstem .. "うて いた"},
			prn = { headstem .. "うて いなかった"},
			srt = { headstem .. "う-てる"},
			pst = { headstem .. "うて-ない" },
			ppr = { headstem .. "うて いました"},
			ppn = { headstem .. "うて いません でした"},
		}
		
		return conj
		
	elseif row == "pro" and head == "言う" and stem == "い" then
		
		conj = {
			pln = { headstem .. ja_onbin(grade, "e") .. " いる", "ゆって いる", "ゆうて いる" },
			neg = { headstem .. ja_onbin(grade, "e") .. " いない", "ゆって いない", "ゆうて いない" },
			pol = { headstem .. ja_onbin(grade, "e") .. " います", "ゆって います", "ゆうて います" },
			png = { headstem .. ja_onbin(grade, "e") .. " いません", "ゆって いません", "ゆうて いません" },
			per = { headstem .. ja_onbin(grade, "e") .. " いた", "ゆって いた", "ゆうて いた" },
			prn = { headstem .. ja_onbin(grade, "e") .. " いなかった", "ゆって いなかった", "ゆうて いなかった" },
			srt = { headstem .. ja_onbin(grade, "e") .. "-る", "ゆって-る", "ゆうて-る" },
			pst = { headstem .. ja_onbin(grade, "e") .. "-ない", "ゆって-ない", "ゆうて-ない" },
			ppr = { headstem .. ja_onbin(grade, "e") .. " いました", "ゆって いました", "ゆうて いました" },
			ppn = { headstem .. ja_onbin(grade, "e") .. " いません でした", "ゆって いません でした", "ゆうて いません でした" },
		}

	elseif row == "pro" and head == "行く" and stem == "い" then
		
		conj = {
			pln = { headstem .. "って いる" },
			neg = { headstem .. "って いない" },
			pol = { headstem .. "って います" },
			png = { headstem .. "って いません" },
			per = { headstem .. "って いた"},
			prn = { headstem .. "って いなかった"},
			srt = { headstem .. "っ-てる"},
			pst = { headstem .. "って-ない" },
			ppr = { headstem .. "って いました"},
			ppn = { headstem .. "って いません でした"},
		}
		
		return conj
		
	-- -te iru form
	elseif row == "pro" and ou == false then
		
		if grade == "suru" or grade == "suru-tsu" or sk == true then return {
			pln = { headstem .. "して いる" },
			neg = { headstem .. "して いない" },
			pol = { headstem .. "して います" },
			png = { headstem .. "して いません" },
			per = { headstem .. "して いた"},
			prn = { headstem .. "して いなかった"},
			srt = { headstem .. "し-てる"},
			pst = { headstem .. "して-ない" },
			ppr = { headstem .. "して いました"},
			ppn = { headstem .. "して いません でした"},
		} elseif grade == "kuru" then return {
			pln = { headstem .. "きて いる" },
			neg = { headstem .. "きて いない" },
			pol = { headstem .. "きて います" },
			png = { headstem .. "きて いません" },
			per = { headstem .. "きて いた"},
			prn = { headstem .. "きて いなかった"},
			srt = { headstem .. "き-てる"},
			pst = { headstem .. "きて-ない" },
			ppr = { headstem .. "きて いました"},
			ppn = { headstem .. "きて いません でした"},
		} elseif grade == "zuru" then return {
			pln = { headstem .. "じて いる" },
			neg = { headstem .. "じて いない" },
			pol = { headstem .. "じて います" },
			png = { headstem .. "じて いません" },
			per = { headstem .. "じて いた"},
			prn = { headstem .. "じて いなかった"},
			srt = { headstem .. "じ-てる"},
			pst = { headstem .. "じて-ない" },
			ppr = { headstem .. "じて いました"},
			ppn = { headstem .. "じて いません でした"},
		} end
		
		conj = grade == "ichi" and {
			pln = { headstem .. "て いる" },
			neg = { headstem .. "て いない" },
			pol = { headstem .. "て います" },
			png = { headstem .. "て いません" },
			per = { headstem .. "て いた"},
			prn = { headstem .. "て いなかった"},
			srt = { headstem .. "-てる"},
			pst = { headstem .. "-て-ない" },
			ppr = { headstem .. "て いました"},
			ppn = { headstem .. "て いません でした"},
		} or {
			pln = { headstem .. ja_onbin(grade, "e") .. " いる" },
			neg = { headstem .. ja_onbin(grade, "e") .. " いない" },
			pol = { headstem .. ja_onbin(grade, "e") .. " います" },
			png = { headstem .. ja_onbin(grade, "e") .. " いません" },
			per = { headstem .. ja_onbin(grade, "e") .. " いた" },
			prn = { headstem .. ja_onbin(grade, "e") .. " いなかった" },
			srt = { headstem .. ja_onbin(grade, "e") .. "-る" },
			pst = { headstem .. ja_onbin(grade, "e") .. "-ない" },
			ppr = { headstem .. ja_onbin(grade, "e") .. " いました" },
			ppn = { headstem .. ja_onbin(grade, "e") .. " いません でした" },
		}
		
		return conj
		
	end
	
	return conj
	
end

function map(tbl, f)
    local t = {}
    for k,v in pairs(tbl) do
        t = f(v)
    end
    return t
end

function get_nth(sentence, n)
    local words = {}

    for word in sentence:gmatch("(+)") do
        words = word
    end

    return words 
end

function splitByKana(text)
    local s = {}
    for i=1, #text, 3 do
        s = text:sub(i, i + 2)
    end
    return s
end

function isGodan(grade)
	return (string.len(grade:gsub("", "")) == 0 and string.len(grade:gsub("", "A")) == 3)
end

function contains(tab, val)
    for index, value in ipairs(tab) do
        if value == val then
            return true
        end
    end

    return false
end

return export