(Translated by https://www.hiragana.jp/)
Modulo:Sinogramma/composti - Wikizionario Vai al contenuto

Modulo:Sinogramma/composti

Da Wikizionario, il dizionario a contenuto aperto.

Questo modulo contiene il codice del Template:SinogrammaComposti, e genera le corrette (sotto)categorie dei composti dei caratteri cinesi.


-- Questo modulo, richiamato nel [[Template:Sinogramma/Composti]], categorizza le sottocategorie dei composti dei caratteri cinesi in base al radicale

local p = {}
function p.sinogramma(frame)

-- variabili richiamate nel template
    tipo = frame.args["tipo"]
    radicale = frame.args["radicale"]
    tratti = frame.args["tratti"]
    titolo = mw.title.getCurrentTitle().subpageText --il titolo della pagina, ovvero della categoria
    
-- variabili interne al modulo
   cat = ""
   
   local carattere = mw.ustring.gsub((tostring(mw.title.getCurrentTitle().subpageText)), '([㐀-䶵一-鿌\239\164\128-\239\171\153𠀀-𯨟])々', '%1%1') --trova i caratteri nel titolo della pagina
		carattere = mw.ustring.gsub(carattere, '[^㐀-䶵一-鿌\239\164\128-\239\171\153𠀀-𯨟]',   '') --rimuove tutto quello che non è carattere cinese dal titolo (spero)
   
   -- lista dei radicali; inserendo come parametro un numero da 1 a 214 restituisce il radicale corrispondente, altrimenti genera un messaggio di errore
	if radicale == "1" then
		rad = "いち"
	elseif radicale == "2" then
		rad = "丨"
	elseif radicale == "3" then
		rad = "丶"
	elseif radicale == "4" then
		rad = "丿"
	elseif radicale == "5" then
		rad = "おつ"
	elseif radicale == "6" then
		rad = "亅"
	elseif radicale == "7" then
		rad = ""
	elseif radicale == "8" then
		rad = "亠"
	elseif radicale == "9" then
		rad = "ひと"
	elseif radicale == "10" then
		rad = "儿"
	elseif radicale == "11" then
		rad = "いれ"
	elseif radicale == "12" then
		rad = "はち"
	elseif radicale == "13" then
		rad = "冂"
	elseif radicale == "14" then
		rad = "冖"
	elseif radicale == "15" then
		rad = "冫"
	elseif radicale == "16" then
		rad = "几"
	elseif radicale == "17" then
		rad = "凵"
	elseif radicale == "18" then
		rad = "かたな"
	elseif radicale == "19" then
		rad = "ちから"
	elseif radicale == "20" then
		rad = "勹"
	elseif radicale == "21" then
		rad = "匕"
	elseif radicale == "22" then
		rad = "匚"
	elseif radicale == "23" then
		rad = "匸"
	elseif radicale == "24" then
		rad = "じゅう"
	elseif radicale == "25" then
		rad = "ぼく"
	elseif radicale == "26" then
		rad = "卩"
	elseif radicale == "27" then
		rad = "厂"
	elseif radicale == "28" then
		rad = "厶"
	elseif radicale == "29" then
		rad = "また"
	elseif radicale == "30" then
		rad = "くち"
	elseif radicale == "31" then
		rad = "囗"
	elseif radicale == "32" then
		rad = ""
	elseif radicale == "33" then
		rad = ""
	elseif radicale == "34" then
		rad = "夂"
	elseif radicale == "35" then
		rad = "夊"
	elseif radicale == "36" then
		rad = "ゆう"
	elseif radicale == "37" then
		rad = "だい"
	elseif radicale == "38" then
		rad = "おんな"
	elseif radicale == "39" then
		rad = ""
	elseif radicale == "40" then
		rad = "宀"
	elseif radicale == "41" then
		rad = "すん"
	elseif radicale == "42" then
		rad = "しょう"
	elseif radicale == "43" then
		rad = "尢"
	elseif radicale == "44" then
		rad= "しかばね"
	elseif radicale == "45" then
		rad = "屮"
	elseif radicale == "46" then
		rad = "やま"
	elseif radicale == "47" then
		rad = "巛"
	elseif radicale == "48" then
		rad = "こう"
	elseif radicale == "49" then
		rad = "おのれ"
	elseif radicale == "50" then
		rad = "はば"
	elseif radicale == "51" then
		rad = ""
	elseif radicale == "52" then
		rad = "幺"
	elseif radicale == "53" then
		rad = "广"
	elseif radicale == "54" then
		rad = "廴"
	elseif radicale == "55" then
		rad = "廾"
	elseif radicale == "56" then
		rad = "弋"
	elseif radicale == "57" then
		rad = "ゆみ"
	elseif radicale == "58" then
		rad = "彐"
	elseif radicale == "59" then
		rad = "彡"
	elseif radicale == "60" then
		rad = "彳"
	elseif radicale == "61" then
		rad ="しん"
	elseif radicale == "62" then
		rad = "ほこ"
	elseif radicale == "63" then
		rad = ""
	elseif radicale == "64" then
		rad = ""
	elseif radicale == "65" then
		rad = "ささえ"
	elseif radicale == "66" then
		rad = "攴"
	elseif radicale == "67" then
		rad = "ぶん"
	elseif radicale == "68" then
		rad = ""
	elseif radicale == "69" then
		rad = "きん"
	elseif radicale == "70" then
		rad = "かた"
	elseif radicale == "71" then
		rad = "无"
	elseif radicale == "72" then
		rad = "にち"
	elseif radicale == "73" then
		rad = "曰"
	elseif radicale == "74" then
		rad = "つき"
	elseif radicale == "75" then
		rad = ""
	elseif radicale == "76" then
		rad = "かけ"
	elseif radicale == "77" then
		rad = "とめ"
	elseif radicale == "78" then
		rad = "歹"
	elseif radicale == "79" then
		rad = "殳"
	elseif radicale == "80" then
		rad = "毋"
	elseif radicale == "81" then
		rad = ""
	elseif radicale == "82" then
		rad = "もう"
	elseif radicale == "83" then
		rad = ""
	elseif radicale == "84" then
		rad = "气"
	elseif radicale == "85" then
		rad = "みず"
	elseif radicale == "86" then
		rad = ""
	elseif radicale == "87" then
		rad = "つめ"
	elseif radicale == "88" then
		rad = "ちち"
	elseif radicale == "89" then
		rad = "爻"
	elseif radicale == "90" then
		rad = "爿"
	elseif radicale == "91" then
		rad = "へん"
	elseif radicale == "92" then
		rad = "きば"
	elseif radicale == "93" then
		rad = "うし"
	elseif radicale == "94" then
		rad = "いぬ"
	elseif radicale == "95" then
		rad = "げん"
	elseif radicale == "96" then
		rad = "たま"
	elseif radicale == "97" then
		rad = "ふり"
	elseif radicale == "98" then
		rad = "かわら"
	elseif radicale == "99" then
		rad = "あま"
	elseif radicale == "100" then
		rad = "なま"
	elseif radicale == "101" then
		rad = "よう"
	elseif radicale == "102" then
		rad = ""
	elseif radicale == "103" then
		rad = "疋"
	elseif radicale == "104" then
		rad = "疒"
	elseif radicale == "105" then
		rad = "癶"
	elseif radicale == "106" then
		rad = "しろ"
	elseif radicale == "107" then
		rad = "かわ"
	elseif radicale == "108" then
		rad = "さら"
	elseif radicale == "109" then
		rad = ""
	elseif radicale == "110" then
		rad = "ほこ"
	elseif radicale == "111" then
		rad = ""
	elseif radicale == "112" then
		rad = "いし"
	elseif radicale == "113" then
		rad = "しめせ"
	elseif radicale == "114" then
		rad = "禸"
	elseif radicale == "115" then
		rad = "禾"
	elseif radicale == "116" then 
		rad = "あな"
	elseif radicale == "117" then
		rad = "だて"
	elseif radicale == "118" then
		rad = "たけ"
	elseif radicale == "119" then
		rad = "べい"
	elseif radicale == "120" then
		rad = "いと"
	elseif radicale == "121" then
		rad = "かん"
	elseif radicale == "122" then
		rad = "网"
	elseif radicale == "123" then
		rad = "ひつじ"
	elseif radicale == "124" then
		rad = "はね"
	elseif radicale == "125" then
		rad = "ろう"
	elseif radicale == "126" then
		rad = "而"
	elseif radicale == "127" then
		rad = "耒"
	elseif radicale == "128" then
		rad = "みみ"
	elseif radicale == "129" then
		rad = "聿"
	elseif radicale == "130" then
		rad = "にく"
	elseif radicale == "131" then
		rad = "しん"
	elseif radicale == "132" then
		rad = ""
	elseif radicale == "133" then
		rad = "いたり"
	elseif radicale == "134" then
		rad = "うす"
	elseif radicale == "135" then
		rad = "した"
	elseif radicale == "136" then
		rad = "ます"
	elseif radicale == "137" then
		rad = "ふね"
	elseif radicale == "138" then
		rad = "うしとら"
	elseif radicale == "139" then
		rad = "いろ"
	elseif radicale == "140" then
		rad = "そうこう"
	elseif radicale == "141" then
		rad = "虍"
	elseif radicale == "142" then
		rad = "むし"
	elseif radicale == "143" then
		rad = ""
	elseif radicale == "144" then
		rad = "こう"
	elseif radicale == "145" then
		rad = "ころも"
	elseif radicale == "146" then
		rad = "西にし"
	elseif radicale == "147" then
		rad = ""
	elseif radicale == "148" then
		rad = "かく"
	elseif radicale == "149" then
		rad = "げん"
	elseif radicale == "150" then
		rad = "たに"
	elseif radicale == "151" then
		rad = "まめ"
	elseif radicale == "152" then
		rad = "いのこ"
	elseif radicale == "153" then
		rad = "豸"
	elseif radicale == "154" then
		rad = "かい"
	elseif radicale == "155" then
		rad = "あか"
	elseif radicale == "156" then
		rad = "はし"
	elseif radicale == "157" then
		rad = "あし"
	elseif radicale == "158" then
		rad = ""
	elseif radicale == "159" then
		rad = "くるま"
	elseif radicale == "160" then
		rad = "からし"
	elseif radicale == "161" then
		rad = "たつ"
	elseif radicale == "162" then
		rad = "辵"
	elseif radicale == "163" then
		rad = "邑"
	elseif radicale == "164" then
		rad = "とり"
	elseif radicale == "165" then
		rad = "釆"
	elseif radicale == "166" then
		rad = "さと"
	elseif radicale == "167" then
		rad = "きむ"
	elseif radicale == "168" then
		rad = "ちょう"
	elseif radicale == "169" then
		rad = "もん"
	elseif radicale == "170" then
		rad = "阜"
	elseif radicale == "171" then
		rad = "隶"
	elseif radicale == "172" then
		rad = "ふるとり"
	elseif radicale == "173" then
		rad = "あめ"
	elseif radicale == "174" then
		rad = "あお"
	elseif radicale == "175" then
		rad = ""
	elseif radicale == "176" then
		rad = "めん"
	elseif radicale == "177" then
		rad = "かわ"
	elseif radicale == "178" then
		rad = "韋"
	elseif radicale == "179" then
		rad = "にら"
	elseif radicale == "180" then
		rad = "おと"
	elseif radicale == "181" then
		rad = "ぺーじ"
	elseif radicale == "182" then
		rad = "ふう"
	elseif radicale == "183" then
		rad = ""
	elseif radicale == "184" then
		rad = "しょく"
	elseif radicale == "185" then
		rad = "くび"
	elseif radicale == "186" then
		rad = "こう"
	elseif radicale == "187" then
		rad = "うま"
	elseif radicale == "188" then
		rad = "ほね"
	elseif radicale == "189" then
		rad = "だか"
	elseif radicale == "190" then
		rad = "髟"
	elseif radicale == "191" then
		rad = "鬥"
	elseif radicale == "192" then
		rad = "鬯" 
	elseif radicale == "193" then
		rad = "鬲"
	elseif radicale == "194" then
		rad = "おに"
	elseif radicale == "195" then
		rad = "さかな"
	elseif radicale == "196" then
		rad = "とり"
	elseif radicale == "197" then
		rad = "鹵"
	elseif radicale == "198" then
		rad = "鹿しか"
	elseif radicale == "199" then
		rad = "むぎ"
	elseif radicale == "200" then
		rad = "あさ"
	elseif radicale == "201" then
		rad = ""
	elseif radicale == "202" then
		rad = "きび"
	elseif radicale == "203" then
		rad = "くろ"
	elseif radicale == "204" then
		rad = "黹"
	elseif radicale == "205" then
		rad = "黽"
	elseif radicale == "206" then
		rad = "かなえ"
	elseif radicale == "207" then
		rad = ""
	elseif radicale == "208" then
		rad = "ねずみ"
	elseif radicale == "209" then
		rad = "はな"
	elseif radicale == "210" then
		rad = "ひとし"
	elseif radicale == "211" then
		rad = ""
	elseif radicale == "212" then
		rad = "りゅう"
	elseif radicale == "213" then
		rad = "かめ"
	elseif radicale == "214" then
		rad = "龠"
	else error("radicale non riconosciuto! Inserisci solo il *numero* (da 1 a 214) corrispondente al radicale; trovi la lista in Appendice:Caratteri cinesi/Radicali")
end

	if tonumber(tratti) > 0 and tonumber(tratti) < 10 then 
		numerotratti = "0".. tratti.. " tratti"
	else
		numerotratti = tratti.. " tratti"
	end

	if tipo == "kanji" then
		cat = "Questa categoria raccoglia i composti del carattere <big><big>[[" .. carattere .. "#Giapponese|".. carattere .. "]]</big></big> in giapponese [[Categoria:Composti dei kanji|".. rad .. "]]"
	elseif tipo == "hanzi" then
		cat = "Questa categoria raccoglia i composti del carattere <big><big>[[" .. carattere .. "#Cinese|".. carattere .. "]]</big></big> in cinese [[Categoria:Composti degli hanzi|".. rad .. "]]"
	elseif tipo == "hanja" then
		cat = "Questa categoria raccoglia i composti del carattere <big><big>[[" .. carattere .. "#Coreano|".. carattere .. "]]</big></big> in coreano  [[Categoria:Composti degli hanja|".. rad .. "]]"
	else error("il parametro 'tipo' ammette solo 'hanzi', 'kanji' o 'hanja'")
	end
	
	link = "Per un elenco ragionato ed editabile degli stessi composti, si veda [[Appendice:Caratteri cinesi/Composti/" .. numerotratti .. "/".. carattere .. "]]"
	
	return
		cat .. "<br/><br/>".. link
	end

	return p