模組:Category tree/poscatboiler/data/terms by etymology/sandbox
- 下列說明文檔由Module:documentation所生成。[編輯]
- 相關連結:根頁面 • 根頁面的子頁面 • 本頁面的子頁面 • 链入 • 嵌入包含 • 測試用例 • sandbox of (差異)
此數據子模塊定義了維基詞典分類結構的一部分。
關於poscatboiler
系統的介紹以及如何添加或更改分類,請參見Module:category tree/poscatboiler/data/documentation。
local labels = {}
local raw_categories = {}
local handlers = {}
local raw_handlers = {}
-----------------------------------------------------------------------------
-- --
-- LABELS --
-- --
-----------------------------------------------------------------------------
labels["詞源"] = {
description = "{{{langname}}}詞彙,依其起源分類。",
umbrella_parents = "分类",
parents = {{name = "{{{langcat}}}", raw = true}},
}
labels["AABB-type reduplications"] = {
description = "{{{langname}}} terms that underwent [[reduplication]] in an AABB pattern.",
parents = {"reduplications"},
}
labels["alliterative compounds"] = {
description = "{{{langname}}} noun phrases composed of two or more stems that alliterate.",
umbrella_parents = "Types of compound words by language",
parents = {"compound words", "alliterative phrases"},
}
labels["反義複合詞"] = {
description = "{{{langname}}} compounds in which one part is an antonym of the other.",
parents = {"dvandva compounds"},
}
labels["逆構詞"] = {
description = "{{{langname}}} words formed by reversing a supposed regular formation, removing part of an older term.",
parents = {"詞源"},
}
labels["bahuvrihi compounds"] = {
description = "{{{langname}}} compounds in which the first part (A) modifies the second (B), and whose meaning follows a [[metonymic]] pattern: “<person> having a B that is A.”",
umbrella_parents = "Types of compound words by language",
parents = {"compound words", "exocentric compounds"},
}
labels["blends"] = {
description = "{{{langname}}} words formed by combinations of other words.",
parents = {"詞源"},
}
labels["借詞"] = {
description = "{{{langname}}}中借自其他語言的詞彙。",
parents = {"詞源"},
}
labels["仿譯詞"] = {
description = "{{{langname}}} terms formed by piece-by-piece translations of terms from other languages.",
parents = {"詞源"},
}
labels["catachreses"] = {
description = "{{{langname}}} terms derived from misuses or misapplications of other terms.",
parents = {"詞源"},
}
labels["coinages"] = {
description = "{{{langname}}} terms coined by an identifiable person, organization or other such entity.",
parents = {"terms attributed to a specific source"},
umbrella_parents = {name = "terms attributed to a specific source", is_label = true, sort = " "},
}
labels["compound determinatives"] = {
description = "{{{langname}}} determinatives composed of two or more stems.",
parents = {"compound words", "determiners"},
}
labels["複合詞"] = {
description = "{{{langname}}}中由兩個或以上詞幹組成的詞彙。",
parents = {"詞源"},
}
labels["coordinated pairs"] = {
description = "Terms in {{{langname}}} consisting of a pair of terms joined by a [[coordinating conjunction]].",
parents = {"詞源"},
}
labels["coordinated triples"] = {
-- Avoid saying "a coordinating conjunction" or "coordinating conjunctions"
-- because there can be either one or two conjunctions.
description = "Terms in {{{langname}}} consisting of three terms joined by [[coordinating conjunction]].",
parents = {"詞源"},
}
labels["denominals"] = {
description = "{{{langname}}} terms derived from a noun.",
parents = {"詞源"},
}
labels["deverbals"] = {
description = "{{{langname}}} terms derived from a verb.",
parents = {"詞源"},
}
labels["同源對似詞"] = {
description = "{{{langname}}}中由同一個詞最後派生出來的,在詞形或詞義上相似但不同的詞語。",
parents = {"詞源"},
}
labels["dvandva compounds"] = {
description = "{{{langname}}} words composed of two or more stems whose stems could be connected by an 'and'.",
umbrella_parents = "Types of compound words by language",
parents = {"compound words"},
}
labels["elongated forms"] = {
description = "{{{langname}}} terms where one or more letters or sounds is repeated for emphasis or effect.",
parents = {"詞源"},
}
labels["endocentric compounds"] = {
description = "{{{langname}}} words composed of two or more stems, one of which is the [[w:head (linguistics)|head]] of that compound.",
umbrella_parents = "Types of compound words by language",
parents = {"compound words"},
}
labels["endocentric noun-noun compounds"] = {
description = "{{{langname}}} words composed of two or more stems, one of which is the [[w:head (linguistics)|head]] of that compound.",
umbrella_parents = "Types of compound words by language",
parents = {"endocentric compounds", "compound words"},
}
labels["endocentric verb-noun compounds"] = {
description = "{{{langname}}} compounds in which the first element is a verbal stem, the second a nominal stem and the head of the compound.",
umbrella_parents = "Types of compound words by language",
parents = {"endocentric compounds", "verb-noun compounds"},
}
labels["eponyms"] = {
description = "{{{langname}}} terms derived from names of real or fictitious people.",
parents = {"詞源"},
}
labels["exocentric compounds"] = {
description = "{{{langname}}} words composed of two or more stems, none of which is the [[w:head (linguistics)|head]] of that compound.",
umbrella_parents = "Types of compound words by language",
parents = {"compound words"},
}
labels["exocentric verb-noun compounds"] = {
description = "{{{langname}}} compounds in which the first element is a transitive verb, the second a noun functioning as its direct object, and whose referent is the person or thing doing the action.",
umbrella_parents = "Types of compound words by language",
parents = {"exocentric compounds", "verb-noun compounds"},
}
labels["genericized trademarks"] = {
description = "{{{langname}}} terms that originate from [[trademark]]s, [[brand]]s and company names which have become [[genericized]]; that is, fallen into common usage in the target market's [[vernacular]], even when referring to other competing brands.",
parents = {"詞源"},
}
labels["ghost words"] = {
description = "{{{langname}}} terms that were originally erroneous or fictitious, published in a reference work as if they were genuine as a result of typographical error, misreading, or misinterpretation, or as [[:w:Fictitious entry|fictitious entries]], jokes, or hoaxes.",
parents = {"詞源"},
}
labels["karmadharaya compounds"] = {
description = "{{{langname}}} words composed of two or more stems in which the main stem determines the case endings.",
umbrella_parents = "Types of compound words by language",
parents = {"tatpurusa compounds"},
}
labels["haplological forms"] = {
description = "{{{langname}}} terms that underwent [[haplology]]: thus, their origin involved a loss or omission of a repeated sequence of sounds.",
parents = {"詞源"},
}
labels["homophonic translations"] = {
description = "{{{langname}}} terms that were borrowed by matching the etymon phonetically, without regard for the sense; compare [[phono-semantic matching]] and [[Hobson-Jobson]].",
parents = {"詞源"}
}
labels["hybridisms"] = {
description = "{{{langname}}} words formed by elements of different linguistic origins.",
parents = {"詞源"},
}
labels["繼承詞"] = {
description = "{{{langname}}}中繼承自本語言更早期形式的詞彙。",
parents = {"詞源"},
}
labels["itaretara dvandva compounds"] = {
description = "{{{langname}}} words composed of two or more stems whose stems could be connected by an 'and'.",
umbrella_parents = "Types of compound words by language",
parents = {"dvandva compounds"},
}
labels["learned borrowings"] = {
description = "{{{langname}}} terms that are learned [[loanword]]s, that is, words that were directly incorporated from another language instead of through normal language contact.",
parents = {"borrowed terms"},
}
labels["legal doublets"] = {
description = "{{{langname}}} legal [[doublet]]s – a legal doublet is a standardized phrase commonly use in legal documents, proceedings etc which includes two words that are near synonyms.",
parents = {"coordinated pairs"},
}
labels["legal triplets"] = {
description = "{{{langname}}} legal [[triplet]]s – a legal triplet is a standardized phrase commonly use in legal documents, proceedings etc which includes three words that are near synonyms.",
parents = {"coordinated triples"},
}
labels["merisms"] = {
description = "{{{langname}}} [[merism]]s – terms that are [[coordinate]]s that, combined, are a synonym for a totality.",
parents = {"coordinated pairs"},
}
labels["metonyms"] = {
description = "{{{langname}}} terms whose origin involves calling a thing or concept not by its own name, but by the name of something intimately associated with that thing or concept.",
parents = {"詞源"},
}
labels["新詞"] = {
description = "{{{langname}}} terms that have been only recently acknowledged.",
parents = {"詞源"},
}
labels["nonce terms"] = {
description = "{{{langname}}} terms that have been invented for a single occasion.",
parents = {"詞源"},
}
labels["numeronyms"] = {
description = "{{{langname}}} terms that serve as number-based names.",
parents = {"詞源"},
}
labels["擬聲詞"] = {
description = "{{{langname}}} words that were coined to sound like what they represent.",
parents = {"詞源"},
}
labels["形譯詞"] = {
description = "{{{langname}}} orthographic loans, i.e. terms that were borrowed in their script forms, not their pronunciations.",
parents = {"借詞"},
}
labels["partial calques"] = {
description = "{{{langname}}} [[Appendix:Glossary#partial calque|partial calques]], i.e. terms formed partly by piece-by-piece translations of terms from other languages and partly by direct borrowing.",
parents = {"詞源"},
}
labels["音義兼譯詞"] = {
description = "{{{langname}}}中在音譯的同時照顧到詞義的詞語。",
parents = {"借詞"},
}
labels["piecewise doublets"] = {
description = "{{{langname}}} terms that are [[Appendix:Glossary#piecewise doublet|piecewise doublets]].",
parents = {"詞源"},
}
labels["pseudo-loans"] = {
description = "{{{langname}}} terms that are [[pseudo-loan]]s.",
parents = {"詞源"},
}
labels["rebracketings"] = {
description = "{{{langname}}} terms that have interacted with another word in such a way that the boundary between the words has been modified.",
parents = {"詞源"}
}
labels["重構詞語"] = {
description = "{{{langname}}} terms that are not directly attested, but have been reconstructed through other evidence.",
parents = {"詞源"}
}
labels["reduplicated coordinated pairs"] = {
description = "{{{langname}}} reduplicated coordinated pairs.",
parents = {"coordinated pairs", "reduplications"},
}
labels["reduplicated coordinated triples"] = {
description = "{{{langname}}} reduplicated coordinated triples.",
parents = {"coordinated triples", "reduplications"},
}
labels["疊詞"] = {
description = "{{{langname}}}中通過詞根或詞幹的重複構造出的詞彙。",
parents = {"詞源"},
}
labels["retronyms"] = {
description = "{{{langname}}} terms that serve as new unique names for older objects or concepts whose previous names became ambiguous.",
parents = {"詞源"},
}
labels["rhyming compounds"] = {
description = "{{{langname}}} noun phrases composed of two or more stems that rhyme.",
umbrella_parents = "Types of compound words by language",
parents = {"compound words", "rhyming phrases"},
}
labels["roots"] = {
description = "Basic morphemes from which {{{langname}}} words are formed.",
parents = {"morphemes"},
}
labels["roots by shape"] = {
description = "{{{langname}}} roots categorized by their shape.",
parents = {{name = "roots", sort = "shape"}},
}
labels["Sanskritic compounds"] = {
description = "{{{langname}}} compounds made of [[tatsama|tatsamas]].",
umbrella_parents = "Types of compound words by language",
parents = {"compound words", "terms derived from Sanskrit"},
}
labels["samahara dvandva compounds"] = {
description = "{{{langname}}} words composed of two or more stems whose stems could be connected by an 'and'.",
umbrella_parents = "Types of compound words by language",
parents = {"dvandva compounds"},
}
labels["意譯詞"] = {
description = "{{{langname}}}中意譯自其他語言的詞。",
parents = {"詞源"},
}
labels["semi-learned borrowings"] = {
description = "{{{langname}}} terms that are [[semi-learned borrowing|semi-learned]] [[loanword]]s, that is, words borrowed from a [[classical language]] into a modern language and partly reshaped based on later [[sound change]]s or by analogy with [[inherit]]ed words in the language.",
parents = {"borrowed terms"},
}
labels["sound-symbolic terms"] = {
description = "{{{langname}}} terms that use {{w|sound symbolism}} to express ideas but which are not necessarily strictly speaking [[onomatopoeic]].",
parents = {"詞源"},
}
labels["spelled-out initialisms"] = {
description = "{{{langname}}} initialisms in which the letter names are spelled out.",
parents = {"詞源"},
}
labels["spelling pronunciations"] = {
description = "{{{langname}}} terms whose pronunciation was historically or presently affected by their spelling.",
parents = {"詞源"},
}
labels["spoonerisms"] = {
description = "{{{langname}}} terms in which the initial sounds of component parts have been exchanged, as in \"crook and nanny\" for \"nook and cranny\".",
parents = {"詞源"},
}
labels["synonymous compounds"] = {
description = "{{{langname}}} compounds in which one part is a synonym of the other.",
umbrella_parents = "Types of compound words by language",
parents = {"dvandva compounds", sort = "synonym"},
}
labels["tatpurusa compounds"] = {
description = "{{{langname}}} words composed of two or more stems",
umbrella_parents = "Types of compound words by language",
parents = {"compound words"},
}
labels["terms attributed to a specific source"] = {
description = "{{{langname}}} terms coined by an identifiable person or deriving from a known work.",
parents = {"詞源"},
}
labels["terms derived from area codes"] = {
description = "{{{langname}}} terms derived from [[area code]]s.",
parents = {"詞源"},
}
labels["terms derived from the shape of letters"] = {
description = "{{{langname}}} terms derived from the shape of letters. This can include terms derived from the shape of any letter in any alphabet.",
parents = {"詞源"},
}
labels["terms by Proto-Indo-European word"] = {
description = "{{{langname}}} terms categorized by the [[w:Proto-Indo-European language|Proto-Indo-European]] word they originate from.",
parents = {"詞源", "terms derived from Proto-Indo-European"},
}
labels["依詞根分類的"] = {
description = "{{{langname}}}詞彙,依其起源的詞根分類。",
parents = {"詞源", {name = "詞根", sort = " "}},
}
labels["出自虛構作品的"] = {
description = "{{{langname}}} terms that originate from works of [[fiction]].",
parents = {"terms attributed to a specific source"},
}
for _, source_and_desc in ipairs({
{"DC漫畫", "[[w:DC漫畫|DC漫畫]]"},
{"Duckburg and Mouseton", "[[w:The Walt Disney Company|Disney]]'s ''[[w:Duck universe|Duckburg]] and [[w:Mickey Mouse universe|Mouseton]]'' universe"},
{"《哈利波特》", "英國作家[[w:J·K·罗琳|J·K·羅琳]]虛構作品《[[w:哈利·波特|-{zh-hans:哈利·波特; zh-hant:哈利波特}-》"},
{"《一九八四》", "英國作家[[w:乔治·奥威尔|-{zh-hans:乔治·奥威尔; zh-hant:喬治·歐威爾}-]]虛構作品《[[w:一九八四|一九八四]]》"},
{"《星際爭霸戰》", "美國電視影集《[[w:星際爭霸戰|-{zh-hans:星际旅行:原初系列; zh-hant:星際爭霸戰}-]]》"},
{"《星際大戰》", "美國系列電影《[[w:星際大戰|-{zh-hans:星球大战; zh-hant:星際大戰}-]]》"},
{"《辛普森家庭》", "美國動畫《[[w:辛普森一家|-{zh-hans:辛普森一家; zh-hant:辛普森家庭}-]]》"},
{"托爾金虛構作品", "英國作家[[w:J·R·R·托爾金|J·R·R·托爾金]]所著古典奇幻作品"},
}) do
local source, desc = unpack(source_and_desc)
labels["出自" .. source .. "的"] = {
description = "{{{langname}}}中出自" .. desc .. "的詞語。",
parents = {"出自虛構作品的"},
}
end
labels["terms derived from Greek mythology"] = {
description = "{{{langname}}} terms derived from Greek mythology which have acquired an idiomatic meaning.",
parents = {"terms attributed to a specific source"},
}
labels["派生自職業的"] = {
description = "{{{langname}}}中派生自職業名稱的詞彙。",
parents = {"詞源"},
}
labels["派生詞"] = {
description = "{{{langname}}}中派生自其他語言的詞彙。",
parents = {"詞源"},
}
labels["出自《聖經》的"] = {
description = "{{{langname}}}中出自《[[聖經]]》的詞語。",
parents = {"terms attributed to a specific source"},
}
labels["派生自地名的"] = {
description = "{{{langname}}}中出自真實或虛構地名的詞語。",
parents = {"詞源"},
}
labels["terms making reference to character shapes"] = {
description = "{{{langname}}} terms making reference to character shapes.",
parents = {"詞源"},
}
labels["terms with Indo-Aryan extensions"] = {
description = "{{{langname}}} terms extended with particular [[Indo-Aryan]] [[pleonastic]] affixes.",
parents = {"詞源"},
}
labels["terms with lemma and non-lemma form etymologies"] = {
description = "{{{langname}}} terms consisting of both a lemma and non-lemma form, of different origins.",
breadcrumb = "lemma and non-lemma form",
parents = {"terms with multiple etymologies"},
}
labels["有多個詞源的"] = {
description = "起源於多個源頭的{{{langname}}}詞語。",
parents = {"詞源"},
}
labels["terms with multiple lemma etymologies"] = {
description = "{{{langname}}} lemmas that are derived from multiple origins.",
breadcrumb = "multiple lemmas",
parents = {"terms with multiple etymologies"},
}
labels["terms with multiple non-lemma form etymologies"] = {
description = "{{{langname}}} non-lemma forms that are derived from multiple origins.",
breadcrumb = "multiple non-lemma forms",
parents = {"terms with multiple etymologies"},
}
labels["詞源不明的"] = {
description = "{{{langname}}} terms whose etymologies have not yet been established.",
parents = {{name = "詞源", sort = "unknown etymology"}},
}
labels["回借詞"] = {
description = "{{{langname}}}中借自其他語言中某個借自{{{langname}}}的詞的詞。",
parents = {"詞源", "借詞"},
}
labels["unadapted borrowings"] = {
description = "{{{langname}}} [[loanword]]s that have not been conformed to the morpho-syntactic, phonological and/or phonotactical rules of the target language.",
parents = {"borrowed terms"},
}
labels["univerbations"] = {
description = "{{{langname}}} terms that result from the agglutination of two or more words.",
parents = {"詞源"},
}
labels["verb-noun compounds"] = {
description = "{{{langname}}} compounds in which the first element is a transitive verb, the second a noun functioning as its direct object, and whose referent is the person or thing doing the action.",
umbrella_parents = "Types of compound words by language",
parents = {"compound nouns"},
}
labels["vrddhi derivatives"] = {
description = "{{{langname}}} terms derived from a Proto-Indo-European root by the process of [[w:vṛddhi|vṛddhi]] derivation.",
umbrella_parents = "Types of compound words by language",
parents = {"詞源"},
}
labels["vrddhi gerundives"] = {
description = "{{{langname}}} [[gerundive]]s derived from a Proto-Indo-European root by the process of [[w:vṛddhi|vṛddhi]] derivation.",
umbrella_parents = "Types of compound words by language",
parents = {"vrddhi derivatives"},
}
labels["vyadhikarana compounds"] = {
description = "{{{langname}}} words composed of two or more stems in which the non-main stem determines the case endings.",
umbrella_parents = "Types of compound words by language",
parents = {"tatpurusa compounds"},
}
labels["words derived through metathesis"] = {
description = "{{{langname}}} words that were created through [[metathesis]] from another word.",
parents = {{name = "詞源", sort = "metathesis"}},
}
for _, fixtype in ipairs({"環綴", "中綴", "間綴", "前綴", "後綴",}) do
labels["依" .. fixtype .. "分類的"] = {
description = "依" .. fixtype .. "分類的{{{langname}}}詞彙。",
parents = {{name = "詞源", sort = fixtype}, fixtype},
}
end
-- Add 'umbrella_parents' key if not already present.
for key, data in pairs(labels) do
if not data.umbrella_parents then
data.umbrella_parents = "詞源子分類"
end
end
-----------------------------------------------------------------------------
-- --
-- RAW CATEGORIES --
-- --
-----------------------------------------------------------------------------
raw_categories["詞源子分類"] = {
description = "Umbrella categories covering topics related to terms categorized by their etymologies, such as types of compounds or borrowings.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "詞源", is_label = true, sort = " "},
},
}
raw_categories["借詞子分類"] = {
description = "Umbrella categories covering topics related to borrowed terms.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "借詞", is_label = true, sort = " "},
{name = "詞源子分類", sort = " "},
},
}
raw_categories["繼承詞子分類"] = {
description = "Umbrella categories covering topics related to inherited terms.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "繼承詞", is_label = true, sort = " "},
{name = "詞源子分類", sort = " "},
},
}
raw_categories["Indo-Aryan extensions"] = {
description = "Umbrella categories covering terms extended with particular [[Indo-Aryan]] [[pleonastic]] affixes.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "Terms by etymology subcategories by language", sort = " "},
},
}
raw_categories["Multiple etymology subcategories by language"] = {
description = "Umbrella categories covering topics related to terms with multiple etymologies.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "Terms by etymology subcategories by language", sort = " "},
},
}
raw_categories["Sanskritic compounds by language"] = {
description = "Categories with terms made of [[tatsama|tatsamas]].",
additional = "{{{umbrella_msg}}}",
parents = {
"Terms by etymology subcategories by language",
},
}
raw_categories["Types of compound words by language"] = {
description = "Umbrella categories covering topics related to types of compound words.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{name = "compound words", is_label = true, sort = " "},
{name = "Terms by etymology subcategories by language", sort = " "},
},
}
-----------------------------------------------------------------------------
-- --
-- HANDLERS --
-- --
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
------------------------------- Root handlers -------------------------------
-----------------------------------------------------------------------------
-- Handlers for 'terms derived from the SOURCE root ROOT' must go *BEFORE* the
-- more general 'terms derived from SOURCE' handler.
local function get_source_and_type_desc(source, term_type)
if source:getCode() == "ine-pro" and term_type:find("^詞根$") then
return "[[w:原始印歐語詞根|原始印歐語" .. term_type .. "]]"
else
return "[[w:" .. source:getWikipediaArticle() .. "|" .. source:getCanonicalName() .. "]] " .. term_type
end
end
-- Handler for e.g. [[:Category:Yola terms derived from the Proto-Indo-European root *h₂el- (grow)]] and
-- [[:Category:Russian terms derived from the Proto-Indo-European word *swé]], and corresponding umbrella
-- categories [[:Category:Terms derived from the Proto-Indo-European root *h₂el- (grow)]] and
-- [[:Category:Terms derived from the Proto-Indo-European word *swé]]. Replaces the former
-- [[Module:category tree/PIE root cat]], [[Module:category tree/root cat]] and [[Template:PIE word cat]].
table.insert(handlers, function(data)
local source_name, term_type, term_and_id = data.label:match("^來自(.+)(詞根)(.+)的$")
if not source_name then
source_name, term_type, term_and_id = data.label:match("^來自(.+)(詞語)(.+)的$")
end
if source_name then
local term, id = term_and_id:match("^(.+) %((.-)%)$")
term = term or term_and_id
local source = require("Module:languages").getByCanonicalName(source_name, true, "allow etym langs")
local parents = {
{ name = "依" .. source_name .. term_type .. "分類的", sort = source:makeSortKey(term) }
}
local umbrella_parents = {
{ name = source_name .. term_type .. "詞源", sort = source:makeSortKey(term) }
}
if id then
table.insert(parents, { name = "來自" .. source_name .. term_type .. term .. "的", sort = " "})
table.insert(umbrella_parents, { name = "來自" .. source_name .. term_type .. term .. "的", is_label = true, sort = " "})
end
-- Italicize the root/word in the title.
local function displaytitle(title, lang)
return require("Module:string").plain_gsub(title, term, require("Module:script utilities").tag_text(term, source, nil, "term"))
end
local breadcrumb = require("Module:script utilities").tag_text(term, source, nil, "term") .. (id and " (" .. id .. ")" or "")
return {
description = "起源於" .. get_source_and_type_desc(source, term_type) ..
require("Module:links").full_link({ term = term, lang = source, gloss = id, id = id }, "term") .. "的{{{langname}}}詞。",
displaytitle = displaytitle,
breadcrumb = breadcrumb,
parents = parents,
umbrella = {
no_by_language = true,
displaytitle = displaytitle,
breadcrumb = breadcrumb,
parents = umbrella_parents,
}
}
end
end)
table.insert(handlers, function(data)
local root_and_id = data.label:match("^詞根為(.+)的$")
if root_and_id then
local root, id = root_and_id:match("^(.+) %((.-)%)$")
root = root or root_and_id
-- See if the language is Semitic.
local fam = data.lang
local is_semitic = false
while true do
if not fam then
break
end
if fam:getCode() == "qfa-not" then
-- qfa-not is "not a family" and is its own parent
break
end
if fam:getCode() == "sem" then
is_semitic = true
break
end
fam = fam:getFamily()
end
local root_desc = is_semitic and "[[w:en:Semitic root|詞根]]" or "詞根"
local parents = {{name = "依詞根分類的", sort = root_and_id}}
local separators = "־ %-"
local separator_c = "[" .. separators .. "]"
local not_separator_c = "[^" .. separators .. "]"
-- remove any leading or trailing separators (e.g. in PIE-style roots)
local root_no_prefix_suffix =
mw.ustring.gsub(mw.ustring.gsub(root, separator_c .. "$", ""), "^" .. separator_c, "")
local num_sep = mw.ustring.len(mw.ustring.gsub(root_no_prefix_suffix, not_separator_c, ""))
local linked_root = data.lang and require("Module:links").full_link({ term = root, lang = data.lang, gloss = id, id = id }, "term") or root
if num_sep > 0 then
table.insert(parents, {name = "" .. (num_sep + 1) .. "字母詞根", sort = root_and_id})
end
local breadcrumb = require("Module:script utilities").tag_text(root, data.lang, nil, "term") .. (id and " (" .. id .. ")" or "")
return {
description = "本分類列出由" .. root_desc .. linked_root .. "構成的{{{langname}}}詞彙。",
displaytitle = "詞根為" .. require("Module:script utilities").tag_text(root, lang, nil, "term") .. "的{{{langname}}}詞",
breadcrumb = breadcrumb,
parents = parents,
umbrella = false,
}
end
end)
table.insert(handlers, function(data)
local num_letters = data.label:match("^([0-9]+)字母詞根$")
if num_letters then
return {
description = "有" .. num_letters .. "個字母的{{{langname}}}詞根。",
parents = {{name = "詞根", sort = "#" .. num_letters}},
umbrella_parents = "詞源子分類",
}
end
end)
table.insert(handlers, function(data)
local source_name = data.label:match("^依(.+)詞根分類的$")
if source_name then
local source = require("Module:languages").getByCanonicalName(source_name, true, "allow etym langs")
local parents = {"詞源"}
-- In [[:Category:Proto-Indo-Iranian terms by Proto-Indo-Iranian root]],
-- don't add parent [[:Category:Proto-Indo-Iranian terms derived from Proto-Indo-Iranian]].
if not data.lang or data.lang:getCode() ~= source:getCode() then
table.insert(parents, "派生自" .. source_name .. "的")
end
return {
description = "{{{langname}}}詞彙,依其起源的" .. get_source_and_type_desc(source, "詞根") .. "分類。",
parents = parents,
umbrella_parents = "詞源子分類",
}
end
end)
table.insert(handlers, function(data)
local root_shape = data.label:match("^(.+)-shape roots$")
if root_shape then
local description = "{{{langname}}} roots with the shape ''" .. root_shape .. "''."
local additional
if data.lang and data.lang:getCode() == "ine-pro" then
additional = [=[
* '''e''' stands for the vowel of the root.
* '''C''' stands for any stop or ''s''.
* '''R''' stands for any resonant.
* '''H''' stands for any laryngeal.
* '''M''' stands for ''m'' or ''w'', when followed by a resonant.
* '''s''' stands for ''s'', when next to a stop.]=]
end
return {
description = description,
additional = additional,
breadcrumb = root_shape,
parents = {{name = "roots by shape", sort = root_shape}},
umbrella = false,
}
end
end)
-----------------------------------------------------------------------------
-------------------- Derived/inherited/borrowed handlers --------------------
-----------------------------------------------------------------------------
-- Handler for categories of the form "派生自SOURCE的LANG詞", where SOURCE is a language, etymology language
-- or family (e.g. "Indo-European languages"), along with corresponding umbrella categories of the form
-- "派生自SOURCE的詞".
table.insert(handlers, function(data)
local source_name = data.label:match("^派生自(.+)的$")
if source_name then
-- FIXME, should we allow 'terms derived from taxonomic names' when mul-tax has canonical name
-- 'taxonomic name'? This is equivalent to what [[Module:category tree/derived cat]] did.
-- Maybe fix mul-tax instead.
local source = require("Module:families").getByCanonicalName(source_name) or
require("Module:etymology languages").getByCanonicalName(source_name) or
require("Module:languages").getByCanonicalName(source_name)
local source_desc = source:makeCategoryLink()
-- Compute description.
local desc = "起源於" .. source_desc .. "的{{{langname}}}詞彙。"
local additional
if source:getType() == "family" then
additional = "理想情況下,本分類應僅含有其他分類。如果詞條歸屬的子分類不明確,也可將之歸類於此。" ..
"如果您知道本分類内的詞條派生自何種語言,請直接編輯相應的詞條。"
end
-- Compute parents.
local derived_from_subvariety_of_self = false
local parent
local sortkey = source:getCanonicalName()
if source:getType() == "etymology language" then
local parcode = source:getParentCode()
if parcode and parcode ~= "qfa-iso" and parcode ~= "qfa-not" and parcode ~= "qfa-und" then
if data.lang and parcode == data.lang:getCode() then
derived_from_subvariety_of_self = true
parent = data.lang:getFamily():getDisplayForm()
else
-- Etymology language parent may be regular language, etymology language,
-- or family
parent = require("Module:languages").getByCode(parcode, true,
"allow etym langs", "allow families"):getDisplayForm()
end
end
else -- regular language or family
local fam = source:getFamily()
if fam and fam:getCode() ~= "qfa-iso" and fam:getCode() ~= "qfa-not" then
parent = fam:getCategoryName()
end
end
parent = parent and "派生自" .. parent .. "的" or "派生詞"
local parents = {{name = parent, sort = sortkey}}
if derived_from_subvariety_of_self then
table.insert(parents, "Category:Categories for terms in a language derived from a term in a subvariety of that language")
end
-- Compute umbrella parents.
local umbrella_parents = {
source:getType() == "family" and {name = source:getCategoryName(), raw = true, sort = " "} or
source:getType() == "etymology language" and {name = "Category:" .. source:getCategoryName(), sort = "派生自"} or
{name = source:getCategoryName(), raw = true, sort = "派生自"}
}
return {
description = desc,
additional = additional,
breadcrumb = source_name,
parents = parents,
umbrella = {
no_by_language = true,
description = "Categories with terms that originate from " .. source_desc .. ".",
parents = umbrella_parents,
},
}
end
end)
local function get_source_and_source_desc(source_name)
local source = require("Module:families").getByCanonicalName(source_name) or
require("Module:etymology languages").getByCanonicalName(source_name) or
require("Module:languages").getByCanonicalName(source_name)
local source_desc = source:makeCategoryLink()
if source:getType() == "family" then
source_desc = "unknown " .. source_desc
end
return source, source_desc
end
-- Handler for categories of the form "借/繼承自SOURCE的LANG詞", where SOURCE is a language,
-- etymology language or family (e.g. "Indo-European languages"). Also handles umbrella categories of the form
-- "借/繼承自SOURCE的詞".
local function inherited_borrowed_handler(etymtype)
return function(data)
local source_name = data.label:match("^" .. etymtype .. "自(.+)的$")
if source_name then
local source, source_desc = get_source_and_source_desc(source_name)
return {
description = "{{{langname}}}中" .. etymtype .. "自" .. source_desc .. "的詞語。",
breadcrumb = source_name,
parents = {
{ name = etymtype .. "詞", sort = source_name },
{ name = "派生自" .. source_name .. "的", sort = " "},
},
umbrella = {
no_by_language = true,
parents = {
{ name = "派生自" .. source_name .. "的", is_label = true, sort = " " },
etymtype == "繼承" and
{ name = "繼承詞子分類", sort = source_name }
-- There are several types of borrowings mixed into the following holding category,
-- so keep these ones sorted under '借自SOURCE_NAME的詞' instead of just
-- 'SOURCE_NAME'.
or "借詞子分類",
}
},
}
end
end
end
table.insert(handlers, inherited_borrowed_handler("借"))
table.insert(handlers, inherited_borrowed_handler("繼承"))
-----------------------------------------------------------------------------
------------------------ Borrowing subtype handlers -------------------------
-----------------------------------------------------------------------------
local function borrowing_subtype_handler(source_name, parent_cat, desc, no_by_language)
local source, source_desc = get_source_and_source_desc(source_name)
return {
description = "{{{langname}}}中" .. desc:gsub("SOURCE", source_desc),
breadcrumb = source_name,
parents = {
{ name = parent_cat, sort = source_name },
{ name = "借自" .. source_name .. "的", sort = " " },
},
umbrella = {
no_by_language = no_by_language,
parents = {
{ name = "借自" .. source_name .. "的", is_label = true, sort = " " },
"借詞子分類",
}
},
}
end
local borrowing_descriptions = {
["學術化借詞"] =
"terms that are learned [[loanword]]s from SOURCE, that is, words that were directly incorporated from SOURCE instead of through normal language contact.",
["半接觸借詞"] =
"terms that are [[semi-learned borrowing|semi-learned]] [[loanword]]s from SOURCE, that is, words borrowed from SOURCE (a [[classical language]]) into the target language (a modern language) and partly reshaped based on later [[sound change]]s or by analogy with [[inherit]]ed words in the language.",
["形譯詞"] =
"terms that are orthographic loans from SOURCE, i.e. words that were borrowed from SOURCE in their script forms, not their pronunciations.",
["非同化借詞"] =
"[[loanword]]s from SOURCE that have not been conformed to the morpho-syntactic, phonological and/or phonotactical rules of the target language.",
}
table.insert(handlers, function(data)
local borrowing_type, source_name = data.label:match("^(.+)自(.+)的$")
if borrowing_type and borrowing_descriptions[borrowing_type .. "詞"] then
return borrowing_subtype_handler(source_name, borrowing_type .. "詞", borrowing_descriptions[borrowing_type .. "詞"])
end
end)
table.insert(handlers, function(data)
local source_name = data.label:match("^意譯自(.+)的$")
if source_name then
return borrowing_subtype_handler(source_name, "意譯詞",
"[[Appendix:術語表#意譯|意譯]]自SOURCE的詞語。",
"no by language")
end
end)
table.insert(handlers, function(data)
local source_name = data.label:match("^部分仿譯自(.+)的$")
if source_name then
return borrowing_subtype_handler(source_name, "部分仿譯詞",
"[[Appendix:術語表#部分仿譯|部分仿譯]]自SOURCE的詞語。",
"no by language")
end
end)
table.insert(handlers, function(data)
local source_name = data.label:match("^仿譯自(.+)的$")
if source_name then
return borrowing_subtype_handler(source_name, "仿譯詞",
"[[Appendix:術語表#仿譯|仿譯]]自SOURCE的詞語。",
"no by language")
end
end)
table.insert(handlers, function(data)
local source_name = data.label:match("^音義兼譯自(.+)的$")
if source_name then
return borrowing_subtype_handler(source_name, "音義兼譯詞",
"[[w:en:Phono-semantic matching|音義兼譯]]自SOURCE的詞語。",
"no by language")
end
end)
-----------------------------------------------------------------------------
------------------------------ Affix handlers -------------------------------
-----------------------------------------------------------------------------
table.insert(handlers, function(data)
local affixtype, term_and_id = mw.ustring.match(data.label, "^含有(..?綴)(.+)的$")
if affixtype then
local term, id = term_and_id:match("^(.+) %(([^()]+)%)$")
term = term or term_and_id
-- Convert term/alt into affixes if needed
local desc = {
["前綴"] = "含有前綴", --Prefix
["後綴"] = "含有後綴", --Suffix
["環綴"] = "含有環綴", --Circumfix
["複綴"] = "含有複綴", --Duplifix
["中綴"] = "含有中綴", --Infix
["間綴"] = "含有間綴", --Interfix
["插綴"] = "含有插綴", --Transfix
["同綴"] = "含有同綴", --Simulfix
["超音綴"] = "含有超音綴", --Suprafix
["減綴"] = "含有減綴", --Disfix
}
if not desc[affixtype] then
return nil
end
local params = {
["alt"] = {},
["sc"] = {},
["sort"] = {},
["tr"] = {},
}
local args = require("Module:parameters").process(data.args, params)
local sc = data.sc or args.sc and require("Module:scripts").getByCode(args.sc, "sc") or nil
local m_compound = require("Module:compound")
term = m_compound.make_affix(term, data.lang, sc, affixtype)
alt = m_compound.make_affix(args.alt, data.lang, sc, affixtype)
local tr = m_compound.make_affix(args.tr, data.lang, require("Module:scripts").getByCode("Latn"), affixtype)
local m_script_utilities = require("Module:script utilities")
local id_text = id and " (" .. id .. ")" or ""
-- Compute parents.
local parents = {}
if id then
table.insert(parents, {name = "含有" .. affixtype .. term .. "的", sort = id, args = args})
end
table.insert(parents, {name = "依" .. affixtype .. "分類的", sort = data.lang:makeSortKey(data.lang:makeEntryName(args.sort or term))})
return {
description = "{{{langname}}}中" .. desc[affixtype] .. require("Module:links").full_link({
lang = data.lang, term = term, alt = alt, sc = sc, id = id, tr = tr}, "term") .. "的詞語。",
breadcrumb = m_script_utilities.tag_text(alt or term, data.lang, sc, "term"),
displaytitle = "含有" .. affixtype .. m_script_utilities.tag_text(term, data.lang, sc, "term") .. id_text .. "的{{{langname}}}詞",
parents = parents,
umbrella = false,
}, true -- true = args handled
end
end)
-----------------------------------------------------------------------------
---------------------------- Coined-by handlers -----------------------------
-----------------------------------------------------------------------------
table.insert(handlers, function(data)
local coiner = data.label:match("^由(.+)所創造的$")
if coiner then
return {
description = "{{{langname}}}中由" .. coiner .. "所創造的新詞。",
breadcrumb = coiner,
parents = {{
name = "新創詞",
sort = coiner,
}},
umbrella = false,
}
end
end)
-----------------------------------------------------------------------------
-- --
-- RAW HANDLERS --
-- --
-----------------------------------------------------------------------------
-- Handler for umbrella metacategories of the form e.g. [[:Category:Terms derived from Proto-Indo-Iranian roots]]
-- and [[:Category:Terms derived from Proto-Indo-European words]]. Replaces the former
-- [[Module:category tree/PIE root cat]], [[Module:category tree/root cat]] and [[Template:PIE word cat]].
table.insert(raw_handlers, function(data)
local source_name, terms_type = data.category:match("^(.+)(詞根)詞源$")
if not source_name then
source_name, terms_type = data.category:match("^(.+)(詞語)詞源$")
end
if not source_name then
source_name, terms_type = data.category:match("^(.+)(詞語)詞源$")
end
if source_name then
local source = require("Module:etymology languages").getByCanonicalName(source_name) or
require("Module:languages").getByCanonicalName(source_name)
return {
description = "Umbrella categories covering terms derived from particular " .. get_source_and_type_desc(source, terms_type) .. ".",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"Umbrella metacategories",
{ name = terms_type == "詞根" and "詞根" or "詞元", is_label = true, lang = source:getCode(), sort = " " },
{ name = "派生自" .. source_name .. "的", is_label = true, sort = " " .. terms_type },
},
}
end
end)
return {LABELS = labels, RAW_CATEGORIES = raw_categories, HANDLERS = handlers, RAW_HANDLERS = raw_handlers}