모듈:etymology/specialized
보이기
관련 모듈
[편집]local export = {}
local m_str_utils = require("Module:string utilities")
local etymology_module = "Module:etymology"
local ko = require("Module:ko")
local gsub = m_str_utils.gsub
local insert = table.insert
local upper = m_str_utils.upper
local function get_specialized_borrowing_text_insert_cats(data)
local bortype, categories, lang, terms, source, nocap, nocat, senseid, prep =
data.bortype, data.categories, data.lang, data.terms, data.source, data.nocap, data.nocat, data.senseid, data.prep
local function inscat(relationship)
if not nocat then
local display, sourcedisp = require(etymology_module).get_display_and_cat_name(source, "raw")
insert(categories, sourcedisp .. relationship .. " " .. lang:getCanonicalName() .. " 낱말")
end
end
local text, appendix
if bortype == "calque" then
text, data.prep = "번역 차용", "의"
inscat("에서 번역 차용된")
elseif bortype == "partial-calque" then
text, data.prep = "부분 번역 차용", "의"
inscat("에서 부분 번역 차용된")
elseif bortype == "semantic-loan" then
text, data.prep = "의미 차용", "에서"
inscat("에서 의미가 차용된")
elseif bortype == "transliteration" then
text, data.prep = "음역", "의"
inscat("에서 음역된")
elseif bortype == "phono-semantic-matching" then
text, data.prep = "음의 차용", "의"
inscat("에서 음의가 차용된")
else
local langcode = lang:getCode()
if langcode == source:getCode() then
require("Module:debug/track"){ "etymology/specialized/self-as-source", "etymology/specialized/self-as-source/" .. langcode }
inscat("로 다시 차용된")
else
-- bortype이 없는 일반적인 차용의 경우, 이 분류는 Module:etymology에서 처리하므로 여기서 추가하지 않음.
if bortype ~= "borrowing" then
local relationship_text
if bortype == "orthographic" then
relationship_text = "에서 철자 차용된"
elseif bortype == "learned" then
relationship_text = "에서 학술적으로 차용된"
elseif bortype == "semi-learned" then
relationship_text = "에서 반학술적으로 차용된"
elseif bortype == "unadapted" then
relationship_text = "에서 비순화 차용된"
elseif bortype == "adapted" then
relationship_text = "에서 순화 차용된"
end
if relationship_text then
inscat(relationship_text)
end
end
end
if bortype == "borrowing" then
text, appendix, data.prep = "차용", "loanword", "에서"
elseif bortype == "learned" then
text, data.prep = "학술적 차용", "에서"
elseif bortype == "semi-learned" then
text, data.prep = "반학술적 차용", "에서"
elseif bortype == "orthographic" then
text, data.prep = "철자 차용", "에서"
elseif bortype == "unadapted" then
text, data.prep = "비순화 차용", "에서"
elseif bortype == "adapted" then
text, data.prep = "순화 차용", "의"
else
error("내부 오류: 인식할 수 없는 bortype: " .. bortype)
end
end
if terms[1].term == "-" then
data.prep = "에서"
end
appendix = "부록:용어사전#" .. (appendix or text)
local displayText
if senseid then
local senseids, output = mw.text.split(senseid, '!!'), {}
for i, id in ipairs(senseids) do
insert(output, mw.getCurrentFrame():preprocess('{{senseno|' .. lang:getCode() .. '|' .. id .. '}}'))
end
local sense_text = mw.text.listToText(output)
local sense_text_with_josa = ko.allomorphy(sense_text, "top")
local link_text = nocap and text or upper(text)
displayText = sense_text_with_josa .. " " .. '[[' .. appendix .. '|' .. link_text .. ']]' .. "이다."
else
displayText = "[[" .. appendix .. "|" .. (nocap and text or upper(text)) .. "]]"
end
return displayText
end
function export.specialized_borrowing(data)
local lang, sources, terms = data.lang, data.sources, data.terms
data.categories = {}
local text
for i, source in ipairs(sources) do
local iter_data = {
bortype = data.bortype,
categories = data.categories,
lang = lang,
terms = terms,
source = source,
nocap = data.nocap,
nocat = data.nocat,
senseid = data.senseid
}
text = get_specialized_borrowing_text_insert_cats(iter_data)
data.prep = iter_data.prep
end
text = data.notext and "" or text
local formatted_sources = require(etymology_module).format_sources {
lang = lang,
sources = sources,
terms = terms,
sort_key = data.sort_key,
categories = data.categories,
nocat = data.nocat,
sourceconj = data.sourceconj,
}
local formatted_links = require(etymology_module).format_links(terms, data.conj, "etymology/specialized")
return formatted_sources .. " " .. formatted_links .. (data.prep or "") .. " " .. text
end
return export