FANDOM


local export = {}
 
local k2h = {
	['ア']='あ',['イ']='い',['ウ']='う',['エ']='え',['オ']='お',
	['カ']='か',['キ']='き',['ク']='く',['ケ']='け',['コ']='こ',
	['サ']='さ',['シ']='し',['ス']='す',['セ']='せ',['ソ']='そ',
	['タ']='た',['チ']='ち',['ツ']='つ',['テ']='て',['ト']='と',
	['ナ']='な',['ニ']='に',['ヌ']='ぬ',['ネ']='ね',['ノ']='の',
	['ハ']='は',['ヒ']='ひ',['フ']='ふ',['ヘ']='へ',['ホ']='ほ',
	['マ']='ま',['ミ']='み',['ム']='む',['メ']='め',['モ']='も',
	['ヤ']='や',['ユ']='ゆ',['ヨ']='よ',
	['ラ']='ら',['リ']='り',['ル']='る',['レ']='れ',['ロ']='ろ',
	['ワ']='わ',['ヰ']='ゐ',['ヱ']='ゑ',['ヲ']='を',
 
	['ガ']='が',['ギ']='ぎ',['グ']='ぐ',['ゲ']='げ',['ゴ']='ご',
	['ザ']='ざ',['ジ']='じ',['ズ']='ず',['ゼ']='ぜ',['ゾ']='ぞ',
	['ダ']='だ',['ヂ']='ぢ',['ヅ']='づ',['デ']='で',['ド']='ど',
	['バ']='ば',['ビ']='び',['ブ']='ぶ',['ベ']='べ',['ボ']='ぼ',
	['パ']='ぱ',['ピ']='ぴ',['プ']='ぷ',['ペ']='ぺ',['ポ']='ぽ',
	['ヴ']='ゔ',
 
	['ァ']='ぁ',['ィ']='ぃ',['ゥ']='ぅ',['ェ']='ぇ',['ォ']='ぉ',
	['ャ']='ゃ',['ュ']='ゅ',['ョ']='ょ',
	['ッ']='っ',
 
	['ン']='ん'
};
 
local hira_initial = {
	['あ']='Aあ',['い']='Iい',['う']='Uう',['え']='Eえ',['お']='Oお',
	['か']='Kか',['き']='Kき',['く']='Kく',['け']='Kけ',['こ']='Kこ',
	['さ']='Sさ',['し']='Sし',['す']='Sす',['せ']='Sせ',['そ']='Sそ',
	['た']='Tた',['ち']='Cち',['つ']='Tつ',['て']='Tて',['と']='Tと',
	['な']='Nな',['に']='Nに',['ぬ']='Nぬ',['ね']='Nね',['の']='Nの',
	['は']='Hは',['ひ']='Hひ',['ふ']='Fふ',['へ']='Hへ',['ほ']='Hほ',
	['ま']='Mま',['み']='Mみ',['む']='Mむ',['め']='Mめ',['も']='Mも',
	['や']='Yや',['ゆ']='Yゆ',['よ']='Yよ',
	['ら']='Rら',['り']='Rり',['る']='Rる',['れ']='Rれ',['ろ']='Rろ',
	['わ']='Wわ',['ゐ']='Wゐ',['ゑ']='Wゑ',['を']='Wを',
 
	['が']='Gか',['ぎ']='Gき',['ぐ']='Gく',['げ']='Gけ',['ご']='Gこ',
	['ざ']='Zさ',['じ']='Jし',['ず']='Zす',['ぜ']='Zせ',['ぞ']='Zそ',
	['だ']='Dた',['ぢ']='Jち',['づ']='Dつ',['で']='Dて',['ど']='Dと',
	['ば']='Bは',['び']='Bひ',['ぶ']='Bふ',['べ']='Bへ',['ぼ']='Bほ',
	['ぱ']='Pは',['ぴ']='Pひ',['ぷ']='Pふ',['ぺ']='Pへ',['ぽ']='Pほ',
	['ゔ']='Vう'
};
 
local no_dakuten = {
	['が']='か',['ぎ']='き',['ぐ']='く',['げ']='け',['ご']='こ',
	['ざ']='さ',['じ']='し',['ず']='す',['ぜ']='せ',['ぞ']='そ',
	['だ']='た',['ぢ']='ち',['づ']='つ',['で']='て',['ど']='と',
	['ば']='は',['び']='ひ',['ぶ']='ふ',['べ']='へ',['ぼ']='ほ',
	['ぱ']='は',['ぴ']='ひ',['ぷ']='ふ',['ぺ']='へ',['ぽ']='ほ',
	['ゔ']='う'
};
 
local unsutegana = {
	['ぁ']='あ',['ぃ']='い',['ぅ']='う',['ぇ']='え',['ぉ']='お',
	['ゃ']='や',['ゅ']='ゆ',['ょ']='よ',
	['っ']='つ'
};
 
function export.ja(frame)
	text = frame.args[1]
 
	text = mw.ustring.gsub(text, '.', k2h) -- convert katakana to hiragana
	text = mw.ustring.gsub(text, '^.', hira_initial) -- add the initial letter thingy
	text = mw.ustring.gsub(text, '.', no_dakuten) -- strip of dakuten
	text = mw.ustring.gsub(text, '.', unsutegana) -- convert sutegana to "normal" size
	text = mw.ustring.gsub(text, '([あかさたなはまやらわ])ー', '%1あ')
	text = mw.ustring.gsub(text, '([いきしちにひみりゐ])ー', '%1い')
	text = mw.ustring.gsub(text, '([うくすつぬふむゆる])ー', '%1う')
	text = mw.ustring.gsub(text, '([えけせてねへめれゑ])ー', '%1え')
	text = mw.ustring.gsub(text, '([おこそとのほもよろを])ー', '%1お')
	text = mw.ustring.gsub(text, '[ ・。、!?~「」★☆()]', '')
	text = mw.ustring.gsub(text, '[ !]', '')
 
	return text
end
 
return export

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.