Module:User:Huhu9001/000
Appearance
- The following documentation is located at Module:User:Huhu9001/000/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
Lua error in package.lua at line 80: module 'Module:ja-translit' not found
local export = {}
local ruby = require('Module:ja-ruby').ruby_auto
local romaji = require('Module:ja-translit').kana_to_romaji
function export.show(frame)
local args = frame:getParent().args
local data_common = {
['lemma'] = nil,
['ind'] = { 'lemma' }, ['inf'] = { 'ind' }, ['adn'] = { 'ind' }, ['subj'] = { 'ind' }, ['imp'] = { 'ind' },
['inf_a'] = { 'inf' }, ['inf_neg'] = { 'inf_a' }, ['inf_ta'] = { 'inf', 'た' }, ['inf_te'] = { 'inf', 'て' },
['pol_aff'] = { 'inf', 'ま' }, ['pol_neg'] = { 'inf', 'ま' },
['ger'] = { 'inf' }, ['caus'] = { 'inf_a', 'せる' }, ['pass'] = { 'inf_a', 'れる' }, ['potn'] = { 'pass' },
['root'] = { 'lemma' }, ['nomzn'] = { 'root', 'さ' },
['ind_pres_aff_pred'] = { 'ind' }, ['ind_pres_aff_attr'] = { 'adn' }, ['ind_pres_neg'] = { 'inf_neg', 'ない' },
['ind_pret_aff'] = { 'inf_ta' }, ['ind_pret_neg'] = { 'inf_neg', 'なかった' },
['subj_pres_aff'] = { 'subj', 'ば' }, ['subj_pres_neg'] = { 'inf_neg', 'なければ' },
['subj_pret_aff'] = { 'inf_ta', 'ら' }, ['subj_pret_neg'] = { 'inf_neg', 'なかったら' },
['voli_pres_aff'] = { 'inf_a', 'よう' }, ['voli_pres_neg'] = { 'inf_neg', 'なかろう' },
['voli_pret_aff'] = { 'inf_ta', 'ろう' }, ['voli_pret_neg'] = { 'inf_neg', 'なかったろう' },
['imp_aff'] = { 'imp' }, ['imp_neg'] = { 'adn', ' な' },
['inf_pres_aff'] = { 'inf' }, ['inf_pres_neg'] = { 'inf_neg', 'なく' },
['inf_pret_aff'] = { 'inf_te' }, ['inf_pret_neg'] = { 'inf_neg', 'なくて' },
['ind_pres_aff_pol'] = { 'pol_aff', 'す' }, ['ind_pres_neg_pol'] = { 'pol_neg', 'せん' },
['ind_pret_aff_pol'] = { 'pol_aff', 'した' }, ['ind_pret_neg_pol'] = { 'pol_neg', 'せん でした' },
['voli_pres_aff_pol'] = { 'pol_aff', 'しょう' },
['inf_pres_aff_pol'] = { 'pol_aff', 'して' },
notes = {
['voli_pres_aff'] = {{ 'Optative. Use Indicative + <span class="Jpan" lang="ja-Jpan">だろう</span> for persumptive.' }},
['voli_pres_neg'] = {{ 'Presumptive. Rare, usually suppleted by Indicative + <span class="Jpan" lang="ja-Jpan">だろう</span>.' }},
['voli_pret_aff'] = {{ 'Presumptive. Rare, usually suppleted by Indicative + <span class="Jpan" lang="ja-Jpan">だろう</span>.' }},
['voli_pret_neg'] = {{ 'Presumptive. Rare, usually suppleted by Indicative + <span class="Jpan" lang="ja-Jpan">だろう</span>.' }},
['voli_pres_aff_pol'] = {{ 'Optative. Use Indicative + <span class="Jpan" lang="ja-Jpan">でしょう</span> for persumptive.' }},
['inf_pres_aff_pol'] = {{ 'Highly polite. Otherwise use non-polite form.' }},
},
}
--[==[
local pagename = 'ためらう'
local data_inflsp = {
pos = 'v',
['lemma'] = { 'う' },
['inf'] = { 'い' }, ['subj'] = { 'え' }, ['imp'] = { 'え' },
['inf_a'] = { 'わ' }, ['inf_ta'] = { 'った' }, ['inf_te'] = { 'って' },
['potn'] = { 'える' },
['voli_pres_aff'] = { 'おう' },
}--]==]
--[==[
local pagename = '泳ぐ'
local kana = 'およぐ'
local data_inflsp = {
pos = 'v',
['lemma'] = { 'ぐ' },
['inf'] = { 'ぎ' }, ['subj'] = { 'げ' }, ['imp'] = { 'げ' },
['inf_a'] = { 'が' }, ['inf_ta'] = { 'んだ' }, ['inf_te'] = { 'んで' },
['potn'] = { 'げる' },
['voli_pres_aff'] = { 'ごう' },
}--]==]
--[==[
local pagename = '来る'
local kana = 'くる'
local data_inflsp = {
pos = 'v',
['lemma'] = { 'くる' },
['inf'] = { 'き' }, ['subj'] = { 'くれ' }, ['imp'] = { 'こい' },
['inf_a'] = { 'こ' }, ['inf_ta'] = { 'きた' }, ['inf_te'] = { 'きて' },
['caus'] = { 'こさせる' }, ['pass'] = { 'こられる' },
}--]==]
--[==[
local pagename = 'まっとう'
local data_inflsp = {
pos = 'v',
['lemma'] = { '' },
['ind'] = { ' する' }, ['inf'] = { ' し' }, ['subj'] = { ' すれ' }, ['imp'] = { ' しろ', ' せよ' },
['inf_a'] = { ' さ' }, ['inf_neg'] = { ' し' },
['ger'] = {''}, ['potn'] = { ' できる' },
['voli_pres_aff'] = { ' しよう' },
notes = {
['imp_aff'] = { nil, { 'Formal imperative.' } },
}
}--]==]
--[==[
local pagename = '関する'
local kana = 'かんする'
local data_inflsp = {
pos = 'v',
['lemma'] = { 'する' },
['ind'] = { 'する' }, ['inf'] = { 'し' }, ['subj'] = { 'すれ' }, ['imp'] = { 'しろ', 'せよ' },
['inf_a'] = { 'さ' }, ['inf_neg'] = { 'し' },
['ger'] = {''}, ['potn'] = { 'できる' },
['voli_pres_aff'] = { 'しよう' },
notes = {
['imp_aff'] = { nil, { 'Formal imperative.' } },
}
}--]==]
--[==
local pagename = 'ずさん'
local data_inflsp = {
pos = 'a',
['lemma'] = { '' },
['ind'] = { ' だ' }, ['inf'] = { ' に' }, ['adn'] = { ' な' }, ['subj'] = { ' なら' }, ['imp'] = {},
['inf_a'] = {}, ['inf_neg'] = { ' で ' }, ['inf_ta'] = { ' だった' }, ['inf_te'] = { ' で' },
['pol_aff'] = { ' で' }, ['pol_neg'] = { ' で は ありま' },
['ind_pres_aff_pred'] = { ' だ', ' な' },
['subj_pres_aff'] = { ' なら' },
['voli_pres_aff'] = { ' だろう' },
notes = {
['ind_pres_aff_pred'] = { { 'Predicative.' }, { 'Attributive.' } },
['voli_pres_aff'] = {},
['voli_pres_neg'] = {},
['voli_pret_aff'] = {},
['voli_pret_neg'] = {},
['voli_pres_aff_pol'] = {},
}
}--]==]
--local data_inflsp = mw.loadData('Module:ja-infl/verb/' .. frame.args[1])
local function d(name, suffix)
suffix = suffix or ''
if data_inflsp[name] then
local r = {}
for _, form in ipairs(data_inflsp[name]) do
table.insert(r, form .. suffix)
end
r.notes = data_inflsp.notes and data_inflsp.notes[name] or data_common.notes[name] mw.logObject(r)
return r
elseif data_common[name] then
local r = d(data_common[name][1], (data_common[name][2] or '') .. suffix)
r.notes = data_inflsp.notes and data_inflsp.notes[name] or data_common.notes[name]
return r
else
return {}
end
end
--local pagename = args['pagename'] or mw.title.getCurrentTitle().text
--local kana = args[1]
local stem_kana, stem_kanji, stem_kana_in_kanji
local lemma_suffix = d('lemma')[1]
if kana then
if kana:gsub('[-^ %.%%]+', '') == pagename then
stem_kana = kana:sub(1, -(lemma_suffix:len() + 1))
else
local len_lemma_suffix = mw.ustring.len(lemma_suffix)
stem_kana = mw.ustring.sub(kana, 1, -(len_lemma_suffix + 1))
stem_kanji, stem_kana_in_kanji = pagename, 0
for i = len_lemma_suffix, 1, -1 do
if mw.ustring.sub(pagename, -i) == mw.ustring.sub(lemma_suffix, -i) then
stem_kanji, stem_kana_in_kanji = mw.ustring.sub(pagename, 1, -(i + 1)), len_lemma_suffix - i
break
end
end
end
else
stem_kana = pagename:sub(1, -(lemma_suffix:len() + 1))
end
local phrase_like = stem_kana:match' '
local notes, notes_ref = {}, {}
local function add_note(note)
if notes_ref[note] then
return notes_ref[note]
else
local nth = #notes + 1
notes_ref[note] = nth
table.insert(notes, '<sup>' .. nth ..'</sup>' .. note)
return nth
end
end
local function grid(name)
local r_form, r_tr = {}, {}
if args[name] then
for form in args[name]:gmatch'(..-)%f[%z;];?' do
local f, n = form:match'^(.-)%f[%z?]%??(.*)$'
local f_kanji, f_kana = f:match'^(.-)%f[%z:]:?(.*)$'
if f_kana == '' then
f_kanji, f_kana = nil, f_kanji
end
local my_notes = {}
for note in n:gmtach'(..-)%f[%z?]%??' do
table.insert(my_notes, add_note(note))
end
my_notes = #my_notes > 0 and '<sup>' .. table.concat(my_notes, ', ') .. '</sup>' or ''
table.insert(r_form, '<span class="Jpan" lang="ja-Jpan">' .. (f_kanji and ruby{
term = f_kanji,
kana = f_kana,
} or f_kana:gsub('[-^ %%%.]+', '')) .. '</span>' .. my_notes)
table.insert(r_tr, '<span class="Latn tr" lang="ja-Latn">' .. romaji(f_kana) .. '</span>')
end
else
local data = d(name)
for i_datum, datum in ipairs(data) do
local my_notes = {}
if data.notes and data.notes[i_datum] then
for _, note in ipairs(data.notes[i_datum]) do
table.insert(my_notes, add_note(note))
end
end
my_notes = #my_notes > 0 and '<sup>' .. table.concat(my_notes, ', ') .. '</sup>' or ''
table.insert(r_form, '<span class="Jpan" lang="ja-Jpan">' .. (stem_kanji and ruby{
term = stem_kanji .. mw.ustring.sub(datum, stem_kana_in_kanji + 1),
kana = stem_kana .. datum,
} or (stem_kana .. datum):gsub('[-^ %%%.]+', '')) .. '</span>' .. my_notes)
table.insert(r_tr, '<span class="Latn tr" lang="ja-Latn">' .. romaji(stem_kana .. datum) .. '</span>')
end
end
if #r_form > 0 then
return table.concat(r_form, ' / ') .. '<br>' .. table.concat(r_tr, ' / ')
else
return ' - '
end
end
return table.concat{
'<div class="NavFrame" style="border:0px;">',
'<div class="NavHead" align="left" style="border:1px solid #aaaaaa; margin-left:-1px; background-color:#CCCCFF;" cellpadding="3">Inflection of "<span class="Jpan" lang="ja">',
pagename,
'</span>" (See [[Appendix:Japanese verbs]].)</div>',
'<div class="NavContent" align="left">\n',
table.concat({
'{| class="wikitable" style="margin-top: 0; text-align: center; width: 100%; margin-bottom: 0;" rules="all"',
'! colspan = "6" | Principal parts',
'|-',
"! ''Mizen'' !! ''Ren'yō'' !! ''Shūshi'' !! ''Reitai'' !! ''Katei'' !! ''Meirei''",
'|-',
'|' .. table.concat({grid('inf_a'), grid('inf'), grid('ind'), grid('adn'), grid('subj'), grid('imp')}, '||'),
'|}',
'{| class="wikitable" style="margin-top: 0; text-align: center; width: 100%; margin-bottom: 0;" rules="all"',
'! colspan = "4" | Inflected forms',
'|-',
'| style="width:20%;" colspan = "2" |',
'! Affirmative !! Negative',
'|-',
'! rowspan = "2" | Indicative',
'! Non-past',
'|' .. grid('ind_pres_aff_pred') .. '||' .. grid('ind_pres_neg'),
'|-',
'! Past',
'|' .. grid('ind_pret_aff') .. '||' .. grid('ind_pret_neg'),
'|-',
'! rowspan = "2" | Subjunctive',
"! (-''ba'')",
'|' .. grid('subj_pres_aff') .. '||' .. grid('subj_pres_neg'),
'|-',
"! (-''tara'')",
'|' .. grid('subj_pret_aff') .. '||' .. grid('subj_pret_neg'),
'|-',
'! rowspan = "2" | ' .. (data_inflsp.pos == 'v' and 'Volitional<br>(Optative/Presumptive)' or 'Presumptive'),
'! Non-past',
'|' .. grid('voli_pres_aff') .. '||' .. grid('voli_pres_neg'),
'|-',
'! Past',
'|' .. grid('voli_pret_aff') .. '||' .. grid('voli_pret_neg'),
'|-',
data_inflsp.pos == 'v' and table.concat({
'! Imperative',
'! Non-past',
'|' .. grid('imp_aff') .. '||' .. grid('imp_neg'),
'|-',
}, '\n') or '',
'! rowspan = "2" | Adverbial',
'! (bare)',
'|' .. grid('inf_pres_aff') .. '||' .. grid('inf_pres_neg'),
'|-',
"! (-''te'')",
'|' .. grid('inf_pret_aff') .. '||' .. grid('inf_pret_neg'),
'|-',
'! colspan = "4" | Inflected forms (polite)',
'|-',
'| colspan = "2" |',
'! Affirmative !! Negative',
'|-',
'! rowspan = "2" | Indicative',
'! Non-past',
'|' .. grid('ind_pres_aff_pol') .. '||' .. grid('ind_pres_neg_pol'),
'|-',
'! Past',
'|' .. grid('ind_pret_aff_pol') .. '||' .. grid('ind_pret_neg_pol'),
'|-',
'! ' .. (data_inflsp.pos == 'v' and 'Volitional<br>(Optative/Presumptive)' or 'Presumptive'),
'! Non-past',
'|' .. grid('voli_pres_aff_pol') .. '||-',
'|-',
'! Adverbial',
"! (-''te'')",
'|' .. grid('inf_pres_aff_pol') .. '||-',
'|}',
data_inflsp.pos == 'v' and table.concat({
'{| class="wikitable" style="margin-top: 0; text-align: center; width: 100%; margin-bottom: 0;" rules="all"',
'! Gerund !! Potential !! Passive !! Causative',
'|-',
'|' .. table.concat({grid('ger'), grid('potn'), grid('pass'), grid('caus')}, '||'),
'|}',
}, '\n') or data_inflsp.pos == 'a' and table.concat({
'{| class="wikitable" style="margin-top: 0; text-align: center; width: 100%; margin-bottom: 0;" rules="all"',
'! Combining form !! Nominalization ("-ness")',
'|-',
'|' .. table.concat({grid('root'), grid('nomzn')}, '||'),
'|}',
}, '\n') or '',
}, '\n'),
'<small>',
table.concat(notes, '<br>'),
'</small>',
'</div></div>',
}
end
return export