Wiktionary
thwiktionary
https://th.wiktionary.org/wiki/%E0%B8%A7%E0%B8%B4%E0%B8%81%E0%B8%B4%E0%B8%9E%E0%B8%88%E0%B8%99%E0%B8%B2%E0%B8%99%E0%B8%B8%E0%B8%81%E0%B8%A3%E0%B8%A1:%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2%E0%B8%AB%E0%B8%A5%E0%B8%B1%E0%B8%81
MediaWiki 1.47.0-wmf.17
case-sensitive
สื่อ
พิเศษ
พูดคุย
ผู้ใช้
คุยกับผู้ใช้
วิกิพจนานุกรม
คุยเรื่องวิกิพจนานุกรม
ไฟล์
คุยเรื่องไฟล์
มีเดียวิกิ
คุยเรื่องมีเดียวิกิ
แม่แบบ
คุยเรื่องแม่แบบ
วิธีใช้
คุยเรื่องวิธีใช้
หมวดหมู่
คุยเรื่องหมวดหมู่
ภาคผนวก
คุยเรื่องภาคผนวก
ดัชนี
คุยเรื่องดัชนี
สัมผัส
คุยเรื่องสัมผัส
อรรถาภิธาน
คุยเรื่องอรรถาภิธาน
TimedText
TimedText talk
มอดูล
คุยเรื่องมอดูล
Event
Event talk
เพดาน
0
1162
5759144
5733661
2026-08-26T09:37:47Z
Jamnanja
16523
/* คำพ้องความ */
5759144
wikitext
text/x-wiki
== ภาษาไทย ==
=== รูปแบบอื่น ===
* {{alt|th|พิดาน}}
=== การออกเสียง ===
{{th-pron|เพ-ดาน}}
=== รากศัพท์ 1 ===
{{bor+|th|xhm|ពិតាន}}, {{m|xhm|ពីតាន}}, {{m|xhm|ពិយតាន}}, {{m|xhm|ពីយតាន}}, {{m|xhm|ពិទារ}}, {{m|xhm|ព្ភិតាន}}, {{m|xhm|ភីត្តាន}}, {{m|xhm|ផ្តាន}}, {{m|xhm|វិតាណ}}, จาก{{der|th|okz-ang|វិតាន}}, จาก{{der|th|sa|वितान}} หรือ{{der|th|pi|วิตาน}}; ร่วมเชื้อสายกับ{{cog|km|ពិតាន}}, {{cog|lo|ເພດານ}}, {{m|lo|ພິດານ}}
==== คำนาม ====
{{th-noun}}
# [[ส่วน]][[ที่]][[สูง]][[ที่สุด]][[ของ]][[ห้อง]][[เป็นต้น]] [[ไม่]][[ว่า]][[จะ]][[มี]][[ฝ้า]][[หรือ]]ไม่[[ก็]][[ตาม]], [[ถ้า]]ไม่มีฝ้า [[หมาย]][[ถึง]]ส่วนสูง[[สุด]]ถึง[[หลังคา]], ถ้ามีฝ้า หมายถึงฝ้า
# [[ระดับ]]สูงสุด
#: {{ux|th|'''เพดาน'''ค่าเล่าเรียน}}
# {{lb|th|คณิต}} [[ฟังก์ชัน]][[ปัด]][[เศษ]][[ขึ้น]][[เป็น]][[จำนวนเต็ม]][[น้อย]]สุดที่[[มาก]][[กว่า]][[หรือ]][[เท่ากับ]][[จำนวน]][[นั้น]], [[เขียน]][[แทน]][[ด้วย]] <math>\lceil x \rceil</math>
===== คำแปลภาษาอื่น =====
{{trans-top|ส่วนที่สูงที่สุดของห้อง}}
* เขิน: {{t+|kkh|ᨴᩨ᩠ᨾ}}
* คำเมือง: {{t+|nod|ᨵᩮᩥ᩠ᨦ}}
* จีน:
*: จีนกลาง: {{t+|cmn|天花板}}, {{t+|cmn|天棚}}
* ไทลื้อ: {{t+|khb|ᦵᦒᦲᧂ}}
* ฟินแลนด์: {{t+|fi|katto}}
* ลาว: {{t+|lo|ເພດານ}}
* อังกฤษ: {{t+|en|ceiling|tr=ซีลิง}}
{{trans-bottom}}
===== คำพ้องความ =====
{{col|th|ปฎล|พิดาน|อุลโลจ}}
==== คำวิสามานยนาม ====
{{th-proper noun}}
# {{lang|th|([[ดาว]]~)}} [[ชื่อ]][[หนึ่ง]][[ของ]][[ดาวฤกษ์]][[อุตรผลคุนี]] [[มี]] 2 [[ดวง]]
#: {{syn|th|วัวตัวเมีย|อุตตรผลคุนี}}
amt9y6b4syd26ankeg9tncmvczi19ru
พันธุ์
0
8921
5759150
2187573
2026-08-26T11:52:14Z
Alifshinobi
397
/* ลูกคำ */
5759150
wikitext
text/x-wiki
{{also/auto}}
== ภาษาไทย ==
=== รูปแบบอื่น ===
* {{alt|th|พันธุ}}
=== รากศัพท์ ===
{{bor+|th|sa|बन्धु}} หรือ{{bor|th|pi|พนฺธุ}}
=== การออกเสียง ===
{{th-pron|พัน}}
=== คำนาม ===
{{th-noun}}
# [[พวกพ้อง]], [[เชื้อสาย]], [[วงศ์วาน]]
# [[เทือก]][[เถา]], [[เหล่ากอ]]
# [[เชื้อ]]
#: {{ux|th|ข้าวเก็บไว้ทำ'''พันธุ์'''}}
#: {{ux|th|'''พันธุ์'''ข้าว}}
==== ลูกคำ ====
{{col4|th|กรรมพันธุ์|เจริญพันธุ์|ชาติพันธุ์|ชาติพันธุ์วรรณนา|ชาติพันธุ์วิทยา|ประสมพันธุ์|ผสมพันธุ์|พ่อพันธุ์|แม่พันธุ์|พืชพันธุ์|เผ่าพันธุ์|พงศ์พันธุ์|พรหมพันธุ์|สืบพันธุ์|แพร่พันธุ์|กลายพันธุ์|สายพันธุ์|สูญพันธุ์|ขยายพันธุ์|สงวนพันธุ์|เมล็ดพันธุ์|พันธุ์ผสม|พันธุ์แท้|คนพันธุ์อา|วิวิธพันธุ์}}
9j27hres9dbjym115hycy0yxbyypjyg
ใน
0
10194
5759122
2664966
2026-08-26T01:41:21Z
Ai Ku Karng
17824
/* รากศัพท์ 1 */
5759122
wikitext
text/x-wiki
== ภาษาไทย ==
=== รูปแบบอื่น ===
* {{alt|th|ไน||เลิกใช้}}
=== การออกเสียง ===
{{th-pron|ไน}}
=== รากศัพท์ 1 ===
{{inh+|th|tai-pro|*C̥.daɰᴬ}}, ซึ่ง /aɰ/ กลายเป็น /aj/, จาก{{der|th|ltc|-}} {{ltc-l|內}}; ร่วมเชื้อสายกับ{{cog|lo|ໃນ}}, {{cog|nod|ᨶᩱ}}, {{cog|khb|ᦺᦓ}}, {{cog|shn|ၼႂ်း}}, {{cog|blt|ꪻꪙ}}, {{cog|aho|𑜃𑜧}}, {{cog|za|ndaw}}, ภาษาจ้วงใต้ naw/ndaw
==== คำบุพบท ====
{{th-prep}}
# [[ตรงกันข้าม]][[กับ]] [[นอก]], [[ไม่]][[ใช่]]นอก, [[อยู่]][[ที่]][[มี]][[สิ่ง]][[อื่น]][[ปิด]][[หรือ]][[ล้อม]][[รอบ]][[อยู่]]
#: {{ux|th|'''ใน'''บ้าน}}
#: {{ux|th|'''ใน'''เมือง}}
===== คำแปลภาษาอื่น =====
{{trans-top|อยู่ที่มีสิ่งอื่นปิดหรือล้อมรอบอยู่}}
* คำเมือง: {{t+|nod|ᨶᩱ}}
* จีน:
*: จีนกลาง: {{t+|cmn|在|tr=zài}}
* ดัตช์: {{t+|nl|in}}
* ไทดำ: {{t+|blt|ꪀꪺꪉ}}
* ไทใหญ่: {{t+|shn|ၼႂ်း}}
* ลาว: {{t+|lo|ໃນ}}
* อังกฤษ: {{t+|en|in|tr=อิน}}
{{trans-bottom}}
=== รากศัพท์ 2 ===
{{bor+|th|km|នៃ||แห่ง, ของ}}
==== คำบุพบท ====
{{th-prep}}
# [[แห่ง]], [[ของ]]
#: {{ux|th|พระราชนิพนธ์ในพระบาทสมเด็จพระมงกุฎเกล้าเจ้าอยู่หัว}}
l9fmqyncv46aolv92w9d2nbneuf3ac2
fax
0
16704
5759132
1904309
2026-08-26T04:24:54Z
Thai-Northeastern
17169
/* การออกเสียง */
5759132
wikitext
text/x-wiki
{{also/auto}}
== ภาษาอังกฤษ ==
=== การออกเสียง ===
* {{enPR|făks}}, {{IPA|en|/fæks/}}
* {{audio|en|en-us-fax.ogg|(อเมริกัน)}}
=== คำนาม ===
{{en-noun|faxes}}
# [[โทรสาร]], [[แฟกซ์]]
=== คำกริยา ===
{{en-verb}}
# [[รับ]][[ส่ง]][[เอกสาร]][[หรือ]][[รูป]][[โดย]][[ใช้]][[โทรสาร]]
== ภาษาจ้วง ==
=== รากศัพท์ ===
{{inh+|za|tai-pro|*vaːꟲ}}; ร่วมเชื้อสายกับ{{cog|th|ฟ้า}}, {{cog|nod|ᨼ᩶ᩣ}}, {{cog|lo|ຟ້າ}}, {{cog|khb|ᦝᦱᧉ}}, {{cog|shn|ၽႃႉ}} หรือ {{m|shn|ၾႃႉ}}, {{cog|blt|ꪡ꫁ꪱ}}, {{cog|aho|𑜇𑜠}}, {{m|aho|𑜇𑜡}}, {{m|aho|𑜇𑜨𑜠}}, {{m|aho|𑜇𑜨𑜡}} หรือ {{m|aho|𑜇𑜞𑜠}}
=== การออกเสียง ===
{{za-pron}}*
* {{คำอ่านไทย|ฟ่า}}
=== คำนาม ===
{{za-head|คำนาม}}
# [[ฟ้า]], [[ท้องฟ้า]]
rl2frbw2vl7wkt2w6wwjkvrebxqfx98
ᨲᩣ
0
19127
5759140
3325440
2026-08-26T07:35:41Z
Ai Ku Karng
17824
/* ภาษาคำเมือง */
5759140
wikitext
text/x-wiki
{{also/auto}}
== ภาษาคำเมือง ==
=== รูปแบบอื่น ===
{{nod-alt|l=ตา|s=ต๋า}}
=== รากศัพท์ ===
{{inh+|nod|tai-swe-pro|*taːᴬ²}}, จาก{{inh|nod|tai-pro|*p.taːᴬ}}; ร่วมเชื้อสายกับ{{cog|th|ตา}}, {{cog|lo|ຕາ}}, {{cog|nyw|ตา}}, {{cog|kkh|ᨲᩣ}}, {{cog|khb|ᦎᦱ}}, {{cog|blt|ꪔꪱ}}, {{cog|shn|တႃ}}, {{cog|tdd|ᥖᥣ}}, {{cog|aio|တႃ}}, {{cog|kht|တႃႈ}}, {{cog|aho|𑜄𑜠}} หรือ {{m|aho|𑜄𑜡}}, {{cog|tyz|tha}}, {{cog|skb|ตร๊อง}}, {{cog|pcc|dal}}, {{cog|za|da}}, {{cog|zzj|ta/ha}}; เทียบในกลุ่มภาษาขร้า-ไท {{cog|swi|ndal}}, {{cog|kmc|dal}}, {{cog|lic|-}} [ʈʂʰaː¹] และ {{cog|onb|-}} [ɗa¹]; เทียบ{{cog|och|-}} {{och-l|睹|เห็น}}, {{cog|map-pro|*mata||ตา}}
=== การออกเสียง ===
* {{IPA|nod|/taː˨˦/|a=เชียงใหม่}}
=== คำนาม ===
{{nod-noun}}
# [[ตา]] (อวัยวะ)
5p6d6zey5pbip5vtvsaajxh7e0e2zp1
5759141
5759140
2026-08-26T07:38:52Z
Ai Ku Karng
17824
/* ภาษาคำเมือง */
5759141
wikitext
text/x-wiki
{{also/auto}}
== ภาษาคำเมือง ==
=== รูปแบบอื่น ===
{{nod-alt|l=ตา|s=ต๋า}}
=== รากศัพท์ ===
{{inh+|nod|tai-swe-pro|*taːᴬ²}}, จาก{{inh|nod|tai-pro|*p.taːᴬ}}; ร่วมเชื้อสายกับ{{cog|th|ตา}}, {{cog|lo|ຕາ}}, {{cog|nyw|ตา}}, {{cog|kkh|ᨲᩣ}}, {{cog|khb|ᦎᦱ}}, {{cog|blt|ꪔꪱ}}, {{cog|shn|တႃ}}, {{cog|tdd|ᥖᥣ}}, {{cog|aio|တႃ}}, {{cog|kht|တႃႈ}}, {{cog|aho|𑜄𑜠}} หรือ {{m|aho|𑜄𑜡}}, {{cog|tyz|tha}}, {{cog|nut|tha}}, {{cog|skb|ตร๊อง}}, {{cog|pcc|dal}}, {{cog|za|da}}, {{cog|zzj|ta/ha}}; เทียบในกลุ่มภาษาขร้า-ไท {{cog|swi|ndal}}, {{cog|kmc|dal}}, {{cog|lic|-}} [ʈʂʰaː¹] และ {{cog|onb|-}} [ɗa¹]; เทียบ{{cog|och|-}} {{och-l|睹|เห็น}}, {{cog|map-pro|*mata||ตา}}
=== การออกเสียง ===
* {{IPA|nod|/taː˨˦/|a=เชียงใหม่}}
=== คำนาม ===
{{nod-noun}}
# [[ตา]] (อวัยวะ)
dtjwmbaxh0kvoxyqtrmy04c8m9mfxi8
ฝาแฝด
0
20137
5759121
2692775
2026-08-25T19:11:44Z
Alifshinobi
397
/* คำแปลภาษาอื่น */
5759121
wikitext
text/x-wiki
== ภาษาไทย ==
[[ไฟล์:TwinGirls.jpg|thumb|right|150px|ฝาแฝด]]
=== รากศัพท์ ===
ร่วมเชื้อสายกับ{{cog|zzj|pa pet|tr=ผาแผด|t=ฝาแฝด}}
=== การออกเสียง ===
{{th-pron|ฝา-แฝด}}
=== คำนาม ===
{{th-noun}}
# มี 2 [[ฝา]]ติดกัน
# [[ผลไม้]]หรือสิ่งอื่นที่ออกมา[[ติด]]กันผิดธรรมดา
# คนที่[[คลอด]]ออกมาพร้อมกัน ตัวอาจจะติดหรือไม่ติดกันก็ได้
==== คำแปลภาษาอื่น ====
{{trans-top|[3]}}
* ไทใหญ่: {{t+|shn|ၽႃၽႄ}}
* โปรตุเกส: {{t+|pt|gémeo|m|tr=แฌมียู}}
* ลาว: {{t+|lo|ຝາແຝດ}}
* สวาฮีลี: {{t+|sw|pacha|c5|c6}}
* สเปน: {{t+|es|gemelo|m}}, {{t+|es|gemela|f}}
* อังกฤษ: {{t+|en|twin}}
{{trans-bottom}}
=== คำเกี่ยวข้อง ===
* {{l|th|แฝด}}
{{topics|th|ครอบครัว}}
l4zwcgkvauptkpg4cr9y4tqfq930a0i
มุฐิ
0
24374
5759145
1897482
2026-08-26T09:41:14Z
Jamnanja
16523
/* รากศัพท์ */
5759145
wikitext
text/x-wiki
==ภาษาไทย==
=== รากศัพท์ ===
{{bor+|th|pi|มุฏฺฐิ||กำปั้น, หมัด}}; เทียบ{{cog|sa|मुष्टि}}
=== การออกเสียง ===
{{th-pron|มุด-ถิ}}
=== คำนาม ===
{{th-noun}}
# {{lb|th|ราชา}} [[กำมือ]], [[กำหมัด]]
o3moxy24qkejseeyjz64awox79ht862
ᨹᩱ
0
37687
5759124
5683989
2026-08-26T01:56:53Z
Ai Ku Karng
17824
/* ภาษาคำเมือง */
5759124
wikitext
text/x-wiki
== ภาษาคำเมือง ==
=== รูปแบบอื่น ===
{{nod-alt|c=ᨹᩲ|~=ไผ}}
=== รากศัพท์ ===
ร่วมเชื้อสายกับ{{cog|tts|ใผ}} หรือ {{m|tts|ไผ}}, {{cog|lo|ໃຜ}}, {{cog|kkh|ᨹᩱ}}, {{cog|khb|ᦺᦕ}}, {{cog|phu|เผอ}}, {{cog|nyw|เผอ}} หรือ {{m|nyw|เผ}}, {{cog|shn|ၽႂ်}}, {{cog|tdd|ᥚᥬᥴ}}, {{cog|aio|ၸၞ်}}, {{cog|phk|ၸၞ်}}, {{cog|aho|𑜇𑜧}} หรือ {{m|aho|𑜇𑜨𑜧}}, {{cog|skb|เด๋อ}}
=== การออกเสียง ===
* {{IPA|nod|/pʰaj˨˦/|a=เชียงใหม่}}
* {{คำอ่านไทย|ไผ<sup>ต่ำ-ขึ้น</sup>}} (ประมาณ)
=== คำสรรพนาม ===
{{nod-pronoun}}
# [[ใคร]]
cornliqfqr78f1as8tedfxzz5vp5c8v
5759125
5759124
2026-08-26T01:59:54Z
Ai Ku Karng
17824
/* ภาษาคำเมือง */
5759125
wikitext
text/x-wiki
== ภาษาคำเมือง ==
=== รูปแบบอื่น ===
{{nod-alt|c=ᨹᩲ|~=ไผ}}
=== รากศัพท์ ===
ร่วมเชื้อสายกับ{{cog|tts|ใผ}} หรือ {{m|tts|ไผ}}, {{cog|lo|ໃຜ}}, {{cog|kkh|ᨹᩱ}}, {{cog|khb|ᦺᦕ}}, {{cog|phu|เผอ}}, {{cog|nyw|เผอ}} หรือ {{m|nyw|เผ}}, {{cog|shn|ၽႂ်}}, {{cog|tdd|ᥚᥬᥴ}}, {{cog|blt|ꪻꪠ}}, {{cog|aio|ၸၞ်}}, {{cog|phk|ၸၞ်}}, {{cog|aho|𑜇𑜧}} หรือ {{m|aho|𑜇𑜨𑜧}}, {{cog|skb|เด๋อ}}
=== การออกเสียง ===
* {{IPA|nod|/pʰaj˨˦/|a=เชียงใหม่}}
* {{คำอ่านไทย|ไผ<sup>ต่ำ-ขึ้น</sup>}} (ประมาณ)
=== คำสรรพนาม ===
{{nod-pronoun}}
# [[ใคร]]
skuosd3w0mfr36j3ivf8jvpd6annzim
มอดูล:Jpan-headword
828
37729
5759137
5752995
2026-08-26T05:18:11Z
Octahedron80
267
5759137
Scribunto
text/plain
local m_ja = require("Module:ja")
local m_ja_ruby = require("Module:ja-ruby")
local m_str_utils = require("Module:string utilities")
local byteoffset = mw.ustring.byteoffset
local concat = table.concat
local gsplit = m_str_utils.gsplit
local insert = table.insert
local kana_to_romaji = require("Module:Hrkt-translit").tr
local max_index = require("Module:table").maxIndex
local moraify = m_ja.moraify
local remove = table.remove
local ugmatch = mw.ustring.gmatch
local ugsub = m_str_utils.gsub
local ulen = m_str_utils.len
local ulower = m_str_utils.lower
local umatch = mw.ustring.match
local usub = m_str_utils.sub
local export = {}
local pos_functions = {}
local range = mw.loadData('Module:ja/data/range')
local Jpan = require("Module:scripts").getByCode("Jpan")
local function remove_links(text)
return (text:gsub("%[%[[^|%]]-|", "")
:gsub("%[%[", "")
:gsub("%]%]", ""))
end
local function assign_kana_to_kanji(head, kana, pagename, template_name)
-- TODO: uses deprecated module
local m_tu = require'Module:template utilities'
local kanji_pos = {[0] = {nil, 0}}
local head_nolink = {}
local link_border = 0
local function insert_kanji_pos(substr)
insert(head_nolink, substr)
for p1, w1 in ugmatch(substr, '()([々' .. range.kanji .. '])') do
p1 = byteoffset(substr, p1) + link_border
insert(kanji_pos, {p1, p1 + w1:len() - 1})
end
end
for p1, p2, w1 in m_tu.gfind_bracket(head, {['%[%['] = ']]'}) do
insert_kanji_pos(head:sub(link_border + 1, p1 - 1))
local p_pipe = w1:find'|' or 2
link_border = p1 + p_pipe - 1
insert_kanji_pos(w1:sub(p_pipe + 1, -3))
link_border = p2
end
insert_kanji_pos(head:sub(link_border + 1))
head_nolink = concat(head_nolink)
local pagetext = mw.title.new(pagename):getContent()
if not pagetext then return head, kana end
local non_kanji = {}
local last_kanji = 1
for p1 in ugmatch(head_nolink, '[々' .. range.kanji .. ']()') do
insert(non_kanji, usub(head_nolink, last_kanji, p1 - 2))
last_kanji = p1
end
insert(non_kanji, usub(head_nolink, last_kanji))
for kanjitab in pagetext:gmatch('(){{%s*' .. template_name) do
kanjitab = select(3, m_tu.find_bracket(pagetext, m_tu.brackets_temp, kanjitab))
if not kanjitab then error('ill-formed [[t:' .. template_name:gsub('%%', '') .. ']] syntax') end
kanjitab = m_tu.parse_temp(kanjitab)
local readings = {}
local readings_len = {}
for i = 1, max_index(kanjitab.args) do
local r_i = kanjitab.args[i] or ''
local r_o = kanjitab.args['o' .. i] or ''
if kanjitab.args['k' .. i] then
readings[i] = kanjitab.args['k' .. i] .. r_o
readings_len[i] = tonumber(r_i:match'^%s*%D*(%d*)%s*$') or 1
else
local r_kana, r_len = r_i:match'^%s*(%D*)(%d*)%s*$'
readings[i] = r_kana .. r_o
readings_len[i] = tonumber(r_len) or 1
end
end
local kana_decom = {}
local reading_id = 1
local reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(kana_decom, non_kanji[i])
insert(kana_decom, readings[reading_id])
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(kana_decom, non_kanji[#non_kanji])
local function strip_nonkana(str, repl)
return ugsub(str, '[^' .. range.kana .. ']+', repl) or nil
end
local xeno_reading = {strip_nonkana(kana, ''):match('^' .. strip_nonkana(concat(kana_decom), '(.-)') .. '$')}
if #xeno_reading > 0 then
local head_decom = {}
reading_id = 1
reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(head_decom, head:sub(kanji_pos[i - 1][2] + 1, kanji_pos[i][1] - 1))
insert(head_decom, head:sub(kanji_pos[i][1], kanji_pos[i + reading_len - 1][2]))
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(head_decom, head:sub(kanji_pos[#non_kanji - 1][2] + 1))
if #head_decom ~= #kana_decom then error('number of parameters in [[t:' .. template_name:gsub('%%', '') .. ']] is incorrect') end
local n_xeno_reading = 0
for i = 1, #kana_decom, 2 do
kana_decom[i] = ugsub(kana_decom[i], '[^' .. range.kana .. ']+', function()
n_xeno_reading = n_xeno_reading + 1
if xeno_reading[n_xeno_reading] == '' then return nil
else return xeno_reading[n_xeno_reading] end
end)
end
return concat(head_decom, '%'), concat(kana_decom, '%')
end
end
return head, kana
end
local en_grades = {
"ระดับ 1", "ระดับ 2", "ระดับ 3",
"ระดับ 4", "ระดับ 5", "ระดับ 6",
"ระดับมัธยมศึกษา", "จิมเมโย", "เฮียวไงจิ"
}
local aliases = {
['transitive']='tr', ['trans']='tr', ['สกรรม']='tr',
['intransitive']='in', ['intrans']='in', ['intr']='in', ['อกรรม']='in',
['godan']='1', ['ichidan']='2', ['irregular']='irr',
['โกดัง']='1', ['อิจิดัง']='2', ['ไม่ปรกติ']='irr'
}
local adverbs_optional_tag = 'optionally '
local adverbs_optional_aliases = {
['to']='と', ['と']='と', ['ト']='と',
['ni']='に', ['に']='に', ['ニ']='に',
}
local adverbs_optional_links = {
['と']='[[と#ภาษาญี่ปุ่น:_adverbs|と]]',
['に']='[[に]]',
}
local function formatting_adjustments(rom, kana, pos_category)
-- hyphens for prefixes, suffixes, and counters (classifiers)
if pos_category == "อุปสรรค" then
rom = rom:gsub('%-?$', '-')
elseif pos_category == "ปัจจัย" or pos_category == "รูปปัจจัย" or pos_category == "คำลักษณนาม" then
rom = rom:gsub('^%-?', '-')
elseif pos_category == "คำวิสามานยนาม" and not kana:match'%^' then -- automatic caps for proper nouns, if not already specified
rom = ugsub(ugsub(rom, '%f[^%s%c%p]%l', string.uupper), "%w'%u", ulower) -- no caps after medial apostrophes
end
return rom
end
local function kana_to_romaji_with_pos_format(kana, data, args)
if data.headword.pos_category == "combining forms" or data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" then
return "-"
end
local rom = remove_links(kana_to_romaji(kana, data.lang_code))
-- make adjustments for -u verbs and -i adjectives
if args['infl'] == '1' or args['infl'] == '1s' or args['infl'] == 'godan' then
rom = rom:gsub('ō$', 'ou'):gsub('ū$', 'uu')
elseif args['infl'] == 'i' or args['infl'] == 'is' or args['infl'] == 'い' then
rom = rom:gsub('ī$', 'ii')
end
return formatting_adjustments(rom, kana, data.headword.pos_category)
end
local function iterate_rare_chars(text)
local ch, i
return function()
repeat
ch, i = umatch(text, "([" .. range.kana .. range.kana_graph .. "!-/:-@%[\\-`×△○◎。-〠〶〷〻-〽・·゠=~][゙゚]*)()", i)
until not (ch and umatch(ch, "^[ぁ-ちっつて-ろんァ-チッツテ-ロンヲ-゚]$"))
return ch
end
end
local function historical_kana(data, hist_kana, modern_kana)
-- Disallow historical kana for kana and morae, as there's no one-to-one correspondence.
local pos = data.headword.pos_category
if pos == "พยางค์" or pos == "คานะ" or pos == "มอรา" then
error(("Cannot specify historical kana for %s."):format(pos))
end
local hist_kana_no_formatting = hist_kana:gsub("[%^%-%. %%]+", "")
local rare_chars, lang_name, hc = {}, data.lang_name, data.headword.categories
for ch in iterate_rare_chars(hist_kana_no_formatting) do
if not (modern_kana and modern_kana:find(ch)) then
rare_chars[ch] = true
end
end
for _, mora in ipairs(moraify((ugsub(hist_kana_no_formatting, "[^" .. range.kana .. "]+", " ")))) do
if not (mora:gsub(" +", ""):match("^.?[\128-\191]*$") or (modern_kana and modern_kana:find(mora))) then
rare_chars[mora] = true
end
end
for ch in pairs(rare_chars) do
insert(hc, lang_name .. " terms historically spelled with " .. ch)
end
insert(data.info_hist, require("Module:ja-link").link({
lang = data.headword.lang,
lemma = hist_kana,
tr = formatting_adjustments(
remove_links(kana_to_romaji(hist_kana, data.lang_code, nil, {hist = true})),
hist_kana,
pos
),
}, {
face = "head",
disableSelfLink = true,
}))
end
local function detect_pagename_kana(data, digraphs)
local pagename = data.pagename
-- Exclude "&" and "@", which are part of %p (e.g. リズム&ブルース).
local function remove_kana(m)
return m:match("[&@]") or ""
end
if ugsub(pagename, '[%p%s%c' .. range.hiragana .. (digraphs and "ゟ" or "") .. ']', remove_kana) == "" then
return 'hira'
elseif ugsub(pagename, '[%p%s%c' .. range.katakana .. (digraphs and "ヿ" or "") .. ']', remove_kana) == "" then
return 'kata'
elseif ugsub(pagename, '[%p%s%c' .. range.kana .. (digraphs and "ゟヿ" or "") .. ']', remove_kana) == "" then
return 'both'
end
end
-- go through args and build inflections by finding whatever kanas were given to us
local function format_headword(args, data)
local pagename, kanas, lang_name = data.pagename, data.kanas, data.lang_name
data.pagename_kana = detect_pagename_kana(data)
if args[1][1] and not args[1][1]:match'[\128-\255]' then
-- filter out POS designations
remove(args[1], 1)
end
local linked_translit = data.headword.lang:link_tr(Jpan)
local suru_ending, rom_suru_ending
if data.headword.pos_category == "คำกริยา する" then
suru_ending = "[[する]]"
rom_suru_ending = linked_translit and " [[suru]]" or " suru"
else
suru_ending, rom_suru_ending = "", ""
end
if data.pagename_kana then -- pure-kana-title entry
if #args.head > 0 or args.head.default then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
-- {{ja-xxx}} vs {{ja-xxx|こ.うし}} vs {{ja-xxx|コウシ}} in [[こうし]]
if not args[1][1] then
args[1][1] = pagename
elseif remove_links(args[1][1]:gsub("[%^%-%. %%]+", "")) ~= pagename then
insert(args[1], 1, pagename)
end
for i, k in ipairs(args[1]) do
insert(data.headword.heads, {
term = k:gsub("[%^%-%. %%]+", "") .. suru_ending,
tr = '-',
l = args.label[i] and {args.label[i]} or nil,
})
end
for i = 1, math.max(args.rom.maxindex, 1) do
local rom = args.rom[i] or args.rom.default or kana_to_romaji_with_pos_format(args[1][1], data, args)
if not data.headword.heads[i] then
data.headword.heads[i] = {term = data.headword.heads[i-1].term}
end
if rom == "-" then
data.headword.heads[i].tr = "-"
elseif linked_translit then
data.headword.heads[i].tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
data.headword.heads[i].tr = rom .. rom_suru_ending
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(args[i][1]:gsub("[%^%-%. %%]+", "")) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
kanas[1] = pagename
if args.hist[1] then
historical_kana(data, args.hist[1], args[1][1])
end
else -- non-pure-kana-title entry
if #args[1] == 0 and not (data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" or data.headword.pos_category == "สัญลักษณ์") then
error("Kana form is required.")
end
if args.head.default == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local rom_repetition_final = {}
for i, k in ipairs(args[1]) do
local rom_auto = kana_to_romaji_with_pos_format(k, data, args)
local head = args.head[i] or args.head.default or pagename
if args.head[i] == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local head_for_ruby, kana_for_ruby
if ulen(head) > 1 and head:match'%%' == nil and k:match'%%' == nil then
head_for_ruby, kana_for_ruby = assign_kana_to_kanji(head, k, pagename, data.lang_code .. '%-kanjitab')
else
head_for_ruby, kana_for_ruby = head, k
end
local format_table = m_ja_ruby.parse_text(head_for_ruby, kana_for_ruby, {
try = 'force',
try_force_limit = 10000,
})
local kana_bare = remove_links(k:gsub("[%^%-%. %%]+", ""))
local rom = args.rom[i] or args.rom.default or rom_auto
head = {
term = m_ja_ruby.to_wiki(format_table, {
break_link = true,
}):gsub('<rt>(..-)</rt>', "<rt>[[" .. kana_bare .."|%1]]</rt>") .. suru_ending,
l = args.label[i] and {args.label[i]} or nil,
}
if rom == "-" or rom_repetition_final[rom] then
head.tr = "-"
elseif linked_translit then
head.tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
head.tr = rom .. rom_suru_ending
end
insert(data.headword.heads, head)
rom_repetition_final[rom] = true
insert(kanas, kana_bare)
if args.hist[i] then
historical_kana(data, args.hist[i], k)
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(m_ja_ruby.to_markup(format_table)) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
local first_reading, multiple = kanas[1]
if not first_reading then
return
end
first_reading = ulower(kana_to_romaji(first_reading, data.lang_code)):gsub("%%", "")
for i = 2, #kanas do
if ulower(kana_to_romaji(kanas[i], data.lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
break
end
end
if not multiple then
local lang_code = data.lang_code
local content = mw.title.getCurrentTitle():getContent()
local loc1, loc2 = content:find("%f[^%z%s]==%s*" .. lang_name:gsub("%-", "%%%-") .. "%s*==()")
loc2 = content:find("%f[^%z%s]==[^\n=]+==", loc2)
if loc1 then
content = content:sub(loc1, loc2)
for template in require("Module:template parser").find_templates(content) do
local name, reading = template:get_name()
if (
name == lang_code .. "-head" or
name == lang_code .. "-pos"
) then
reading = template:get_arguments()[2]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif (
name == lang_code .. "-noun" or
name == lang_code .. "-verb" or
name == lang_code .. "-adj" or
name == lang_code .. "-phrase" or
name == lang_code .. "-verb form" or
name == lang_code .. "-verb-suru"
) then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif name == lang_code .. "-see" then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
-- if umatch(reading, "[^" .. range.kana .. "]") then
-- TODO: check linked page
-- end
end
if reading and ulower(kana_to_romaji(reading, lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
end
end
end
end
if multiple then
insert(data.headword.categories, lang_name .. " terms with multiple readings")
end
end
end
local function add_transitivity(data, tr)
local categories, lang_name = data.headword.categories, data.lang_name
tr = aliases[tr] or tr
if tr == "tr" then
insert(data.info_mid, 'สกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
elseif tr == "in" then
insert(data.info_mid, 'อกรรม')
insert(categories, "คำอกรรมกริยา" .. lang_name)
elseif tr == "both" then
insert(data.info_mid, 'สกรรมหรืออกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
insert(categories, "คำอกรรมกริยา" .. lang_name)
else
insert(categories, "คำกริยา" .. lang_name .. "ที่ไม่มีสกรรมลักษณะ")
end
end
local function get_final(lemma, data)
--return kana_to_romaji(remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma)))), data.lang_code)
return remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma))))
end
local function add_language_fragment(t, lang_name)
for k, v in ipairs(t) do
t[k] = v:gsub("%[%[([^]#]*)%]%]", function (s)
return "[[" .. s .. "#" .. lang_name .. "|" .. s .. "]]"
end)
end
end
local function add_inflections(data, inflection_type, cat_suffix)
local lang_name = data.lang_name
local lemma = data.inflection_base.form
local romaji = data.inflection_base.romaji
inflection_type = aliases[inflection_type] or inflection_type
local function replace_suffix(lemma_from, lemma_to, romaji_from, romaji_to)
-- e.g. 持って来る, lemma = "[持](も)って来(く)る"
-- lemma_from = "くる", lemma_to = {"き","きた"}
add_language_fragment(lemma_to, lang_name)
add_language_fragment(romaji_to, lang_name)
local result = {}
local pattern_from, n_from = lemma_from:gsub('.[\128-\191]*', function(c)
return '[' .. c .. m_ja.hira_to_kata(c) .. ']([^' .. range.kana .. ']*)'
end)
pattern_from = pattern_from .. '$'
-- "[くク]([^kana range]*)[るル]([^kana range]*)$"
for i_lemma_to, s_lemma_to in ipairs(lemma_to) do
local n_to = 0
local pattern_to = s_lemma_to:gsub('.[\128-\191]*', function(c)
if n_to < n_from then
n_to = n_to + 1
return c .. "%" .. n_to
else
return c
end
end)
for i = n_to + 1, n_from do
pattern_to = pattern_to .. "%" .. i
end
-- "き%1%2", "き%1た%2"
local lemma_inflected, success = ugsub(lemma, pattern_from, pattern_to)
if success == 0 then
return
end
local romaji_inflected
romaji_inflected, success = romaji:gsub(romaji_from .. "$", romaji_to[i_lemma_to])
if success == 0 then
romaji_inflected, success = romaji:gsub("%[%[" .. romaji_from .. "%]%]$", "[[" .. romaji_to[i_lemma_to] .. "]]")
if success == 0 then
return
end
end
insert(result, {lemma = lemma_inflected, romaji = romaji_inflected})
end
return result -- {{lemma="[持](も)って来(き)",romaji="motteki"},{lemma="[持](も)って来(き)た",romaji="mottekita"}}
end
local function insert_form(label, ...)
-- label = "stem" or "past" etc.
-- ... = {lemma=...,romaji=...},{lemma=...,romaji=...}
local labeled_forms = {label = label}
for _, v in ipairs{...} do
local table_form = m_ja_ruby.parse_markup(v.lemma)
local form_term = m_ja_ruby.to_wiki(table_form)
if not form_term:find'%[%[.+%]%]' then
form_term = '[[' .. m_ja_ruby.to_text(table_form) .. '#' .. lang_name .. '|' .. form_term .. ']]'
end
insert(labeled_forms, {
term = form_term,
tr = v.romaji,
})
end
insert(data.headword.inflections, labeled_forms)
end
local inflected_forms
if data.lang_code == 'ja' then
if inflection_type == '1' or inflection_type == '1s' then
insert(data.info_mid, '<abbr title="การผันรูปโกดัง (กลุ่ม 1)">โกดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if cat_suffix == "คำกริยา" then
local final = get_final(lemma, data)
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. final)
if final == "る" then
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぃる")
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぇる")
end
end
end
end
if inflection_type == '1' then
inflected_forms =
replace_suffix('く', {'き', 'いた'}, 'ku', {'ki', 'ita'}) or
replace_suffix('ぐ', {'ぎ', 'いだ'}, 'gu', {'gi', 'ida'}) or
replace_suffix('す', {'し', 'した'}, 'su', {'shi', 'shita'}) or
replace_suffix('つ', {'ち', 'った'}, 'tsu', {'chi', 'tta'}) or
replace_suffix('ぬ', {'に', 'んだ'}, 'nu', {'ni', 'nda'}) or
replace_suffix('ぶ', {'び', 'んだ'}, 'bu', {'bi', 'nda'}) or
replace_suffix('む', {'み', 'んだ'}, 'mu', {'mi', 'nda'}) or
replace_suffix('る', {'り', 'った'}, 'ru', {'ri', 'tta'}) or
replace_suffix('う', {'い', 'った'}, 'u', {'i', 'tta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
else
inflected_forms =
replace_suffix('る', {'り', 'った', 'い'}, 'ru', {'ri', 'tta', 'i'}) or --くださる
replace_suffix('いく', {'いき', 'いった'}, 'iku', {'iki', 'itta'}) or --行く
replace_suffix('う', {'い', 'うた'}, 'ou', {'oi', 'ōta'}) --問う
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1], inflected_forms[3])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
end
elseif inflection_type == '2' then
insert(data.info_mid, '<abbr title="การผันรูปอิจิดัง (กลุ่ม 2)">อิจิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "อิจิดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "คามิอิจิดัง" .. lang_name)
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "ชิโมอิจิดัง" .. lang_name)
else
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
end
inflected_forms = replace_suffix('る', {'', 'た'}, 'ru', {'', 'ta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'suru' then
insert(data.info_mid, '<abbr title="การผันรูปซูรุ (กลุ่ม 3)">ซูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " する " .. lang_name)
end
inflected_forms =
replace_suffix('する', {'し', 'した'}, 'suru', {'shi', 'shita'}) or
replace_suffix('ずる', {'じ', 'じた'}, 'zuru', {'ji', 'jita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'kuru' then
insert(data.info_mid, '<abbr title="การผันรูปคูรุ (กลุ่ม 3)">คูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " 来る " .. lang_name)
end
inflected_forms = replace_suffix('くる', {'き', 'きた'}, 'kuru', {'ki', 'kita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'i' or inflection_type == 'い' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('い', {'く'}, 'i', {'ku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'is' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('いい', {'よく'}, 'ii', {'yoku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'na' or inflection_type == 'な' then
insert(data.info_mid, '<abbr title="การผันรูป-นะ (ชนิด 1)">-นะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -な " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[な]]', '[[に]]'}, '', {' [[na]]', ' [[ni]]'})
insert_form('หน่วยนาม', inflected_forms[1])
insert_form('คำกริยาวิเศษณ์', inflected_forms[2])
elseif inflection_type == "yo" then
insert(data.info_mid, '<abbr title="การผันรูปโยดัง (คลาสสิก)"><sup><small>†</small></sup>โยดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. get_final(lemma, data))
end
elseif inflection_type == "kami ni" then
insert(data.info_mid, '<abbr title="การผันรูปคามินิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "คามินิดัง" .. lang_name)
end
elseif inflection_type == "shimo ni" then
insert(data.info_mid, '<abbr title="การผันรูปชิโมนิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "ชิโมนิดัง" .. lang_name)
end
elseif inflection_type == "rahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ริ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ริ</abbr>')
elseif inflection_type == "sahen" then
insert(data.info_mid, '<abbr title="การผันรูป-เซะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-เซะ</abbr>')
elseif inflection_type == "kahen" then
insert(data.info_mid, '<abbr title="การผันรูป-โกะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-โกะ</abbr>')
elseif inflection_type == "nahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ง พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ง</abbr>')
elseif inflection_type == "nari" or inflection_type == "なり" then
insert(data.info_mid, '<abbr title="การผันรูป-นาริ (คลาสสิก)"><sup><small>†</small></sup>-นาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -なり " .. lang_name)
end
elseif inflection_type == 'tari' or inflection_type == 'たり' then
insert(data.info_mid, '<abbr title="การผันรูป-ตาริ (คลาสสิก)"><sup><small>†</small></sup>-ตาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -たり " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[とした]]', '[[たる]]', '[[と]]', '[[として]]'}, '', {' [[to shita]]', ' [[taru]]', ' [[to]]', ' [[to shite]]'})
insert_form('หน่วยนาม', inflected_forms[1], inflected_forms[2])
insert_form('คำกริยาวิเศษณ์', inflected_forms[3], inflected_forms[4])
elseif inflection_type == "ku" or inflection_type == "く" then
insert(data.info_mid, '<abbr title="การผันรูป-กุ (คลาสสิก)"><sup><small>†</small></sup>-กุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -く " .. lang_name)
end
elseif inflection_type == "shiku" or inflection_type == "しく" then
insert(data.info_mid, '<abbr title="การผันรูป-ชิกุ (คลาสสิก)"><sup><small>†</small></sup>-ชิกุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -しく " .. lang_name)
end
elseif inflection_type == "ka" or inflection_type == "か" then
insert(data.info_mid, '<abbr title="การผันรูป-กะ (ภาษาถิ่น)"><sup><small>†</small></sup>-กะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -か " .. lang_name)
end
elseif inflection_type and inflection_type:len() > adverbs_optional_tag:len() and inflection_type:sub(1, adverbs_optional_tag:len()) == adverbs_optional_tag then
local adverbs_optional_list = inflection_type:sub(adverbs_optional_tag:len() + 1)
for option in gsplit(adverbs_optional_list, ':') do
local normalized_option = adverbs_optional_aliases[option]
if not normalized_option then
error('unrecognized adverb opt= argument: "' .. option .. '"')
end
local normalized_option_romaji = kana_to_romaji(normalized_option, data.lang_code)
local normalized_option_link = adverbs_optional_links[normalized_option]
inflected_forms = replace_suffix('', {normalized_option_link}, '', {' [[' .. normalized_option_romaji .. ']]'})
insert_form('optionally as', inflected_forms[1])
if cat_suffix then
insert(data.headword.categories, lang_name .. " " .. cat_suffix .. " optionally taking " .. normalized_option .. "-" .. normalized_option_romaji)
end
end
elseif inflection_type == 'irr' then
insert(data.info_mid, 'ไม่ปรกติ')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
elseif inflection_type == '-' or inflection_type == 'un' then
insert(data.info_mid, 'ผันรูปไม่ได้')
end
--elseif data.lang_code == 'ryu' then ...
end
end
local function add_categories(data)
local lang_name = data.lang_name
local pagename = data.pagename
local tc = data.headword.categories
-- adds category [langname] terms spelled with jōyō kanji or [langname] terms spelled with non-jōyō kanji
-- (if it contains any kanji)
local number_of_kanji = 0
for c in ugmatch(pagename, "[" .. range.kanji .. "々〻]") do
number_of_kanji = number_of_kanji + 1
if c ~= "々" and c ~= "〻" then -- Not a kanji for the purposes of categorisation.
insert(tc, ("ศัพท์" .. lang_name .. "ที่สะกดด้วยคันจิ%s"):format(en_grades[m_ja.kanji_grade(c)]))
insert(tc, ("คำซ้ำ%s"):format(lang_name))
end
end
-- categorize by number of kanji
if number_of_kanji ~= 0 then
insert(tc, ("ศัพท์" .. lang_name .. "ที่มีคันจิ %s ตัว"):format(number_of_kanji))
-- single-kanji terms
if ulen(pagename) == 1 then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. pagename)
insert(tc, "ศัพท์" .. lang_name .. "ที่มีคันจิ 1 ตัวเท่านั้น")
end
end
-- categorize by the script of the pagename or specific characters contained in it
-- if pagename is hiragana or katakana
if detect_pagename_kana(data, true) == 'hira' then insert(tc, "ฮิรางานะ" .. lang_name) end
if detect_pagename_kana(data, true) == 'kata' then insert(data.katakana_category, "คาตากานะ" .. lang_name) end
local p, n = ugsub(pagename, '[' .. range.kana .. range.kanji .. range.ideograph .. range.kana_graph .. range.punctuation .. ']+', '')
if p ~= '' and n > 0 then insert(tc, "ศัพท์" .. lang_name .. "ที่เขียนด้วยอักษรหลายชนิด") end
local pos = data.headword.pos_category
local rare_chars = {}
for ch in iterate_rare_chars(pagename) do
rare_chars[ch] = true
end
-- Categorise yōon, but exclude kana and mora entries, since they can't be spelled with themselves.
-- FIXME: allow kana categories for morae.
if not (pos == "พยางค์" or pos == "คานะ" or pos == "มอรา") then
for _, mora in ipairs(moraify((ugsub(pagename, "[^" .. range.kana .. "]+", " ")))) do
if not mora:gsub(" +", ""):match("^.?[\128-\191]*$") then
rare_chars[mora] = true
end
end
end
for ch in pairs(rare_chars) do
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. ch)
end
if (
pos ~= "สุภาษิต" and
pos ~= "วลี" and
umatch(ugsub(pagename, "[" .. range.katakana .. "]+", ""), "[" .. range.hiragana .. "]") and
umatch(ugsub(pagename, "[" .. range.hiragana .. "]+", ""), "[" .. range.katakana .. "]")
) then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วยคานะผสม")
end
end
pos_functions["คำกริยา"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, args["infl"], 'คำกริยา')
end
pos_functions["ปัจจัย"] = function(args, data)
add_inflections(data, args["infl"])
end
pos_functions["คำกริยาช่วย"] = function(args, data)
insert(data.headword.categories, "คำกริยาช่วย" .. data.lang_name)
add_inflections(data, args["infl"])
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำกริยา する"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, 'suru', 'คำกริยา')
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำคุณศัพท์"] = function(args, data)
add_inflections(data, args["infl"], 'คำคุณศัพท์')
end
pos_functions["คำนาม"] = function(args, data)
-- the counter (classifier) parameter, only relevant for nouns
local counter = args["count"] or ""
if counter == "-" then
insert(data.headword.inflections, {label = "นับไม่ได้"})
elseif counter ~= "" then
insert(data.headword.inflections, {label = "คำลักษณนาม", counter})
end
end
pos_functions["คำกริยาวิเศษณ์"] = function(args, data)
local opt = args["opt"]
if opt then
opt = adverbs_optional_tag .. opt
end
add_inflections(data, opt, 'คำกริยาวิเศษณ์')
end
--[==[
Generate categories by pagename, also optionally by POS
Also for use in soft redirect pages ([[Module:ja-see]]).
Sortkey is not provided.
data = {
pagename = ..., -- (required)
lang = ..., -- (required) language object
categories = {}, -- (required) receive categories
katakana_category = {}, -- (required) receive katakana-sorted categories
pos = ..., "noun", "verb", etc. no POS categories if not given
}
]==]
function export.cat(data)
--data.lang_name = data.lang:getCanonicalName()
data.lang_name = data.lang:getCategoryName()
data.pagename_kana = detect_pagename_kana(data)
if data.pos then
--local pos = data.pos:gsub('x$', 'xe') .. 's'
--insert(data.categories, data.lang_name .. ' ' .. pos)
--insert(data.categories, data.lang_name .. ' ' .. require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. 's')
local pos = data.pos
insert(data.categories, pos .. data.lang_name)
insert(data.categories, require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. data.lang_name)
end
data.headword = {categories = data.categories}
add_categories(data)
end
--[==[
The main entry point.
This is the only function that can be invoked from a template.
]==]
function export.show(frame)
local poscat = frame.args[2] or frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
-- หมวดหมู่เป็นภาษาไทย
local poscat_th = require("Module:th-utilities").th_pos(poscat)
local alias_of_hist = {alias_of = 'hist', list = false}
local alias_of_infl = {alias_of = "infl"}
local list = {list = true}
local list_allow_holes_separate_no_index = {list = true, allow_holes = true, separate_no_index = true}
local params = {
[1] = list,
['rom'] = list_allow_holes_separate_no_index,
['head'] = list_allow_holes_separate_no_index,
['label'] = {list = true, allow_holes = true},
['hist'] = list, ['hhira'] = alias_of_hist, ['hkata'] = alias_of_hist,
['tr'] = true,
['infl'] = true, ['type'] = alias_of_infl, ['decl'] = alias_of_infl,
['opt'] = true,
['count'] = true,
['sort'] = true,
['pagename'] = true,
}
-- For backwards compatibility with uses of {{ja-syllable}} with the script parameter.
if poscat_th == "พยางค์" then
params["sc"] = true
end
local args = require('Module:parameters').process(frame:getParent().args, params)
local data = {
headword = {
pos_category = poscat_th,
categories = {},
heads = {},
no_redundant_head_cat = true,
inflections = {},
genders = {'m'}, -- placeholder
nogendercat = true,
},
--custom info
pagename = args.pagename or mw.loadData("Module:headword/data").pagename,
pagename_kana = nil, -- "hira" "kata" "both", nil
lang_code = frame.args[1],
lang_name = nil, -- "Japanese", "Okinawan" ...
katakana_category = {},
info_mid = {}, -- "godan", "intransitive" ...
info_hist = {}, -- historical kana
inflection_base = {}, -- base of inflections
kanas = {}, -- kana id
}
data.headword.lang = require("Module:languages").getByCode(data.lang_code)
--data.lang_name = data.headword.lang:getCanonicalName()
data.lang_name = data.headword.lang:getCategoryName()
-- sort out all the kanas and do the romanization business
format_headword(args, data)
-- add certain inflections and categories for adjectives, verbs, nouns, or adverbs
if pos_functions[poscat_th] then
pos_functions[poscat_th](args, data)
end
-- categories
add_categories(data)
local sort_base = args.sort or data.kanas[1] or data.pagename
data.headword.sort_key = data.headword.lang:makeSortKey(sort_base)
local katakana_category = #data.katakana_category > 0 and
require("Module:utilities").format_categories(
data.katakana_category,
data.headword.lang,
nil,
sort_base,
nil,
require("Module:scripts").getByCode("Kana")
) or ""
-- output
local i_kanas = 0
return katakana_category .. require('Module:headword').full_headword(data.headword):gsub('<span class="gender">.-</span>', function()
return (#data.info_hist > 0 and '<sup>←' .. concat(data.info_hist, ' or ') .. '<sup>[[w:Historical kana orthography|?]]</sup></sup>' or '') .. ('<i>' .. concat(data.info_mid, ' ') .. '</i>')
end):gsub('<strong .->.-</strong>', function(m0)
i_kanas = i_kanas + 1
if data.kanas[i_kanas] then
return m0
end
end)
end
return export
93195c7bm7gk20qj5ygl8x25bdy1omk
5759138
5759137
2026-08-26T05:35:07Z
Octahedron80
267
5759138
Scribunto
text/plain
local m_ja = require("Module:ja")
local m_ja_ruby = require("Module:ja-ruby")
local m_str_utils = require("Module:string utilities")
local byteoffset = mw.ustring.byteoffset
local concat = table.concat
local gsplit = m_str_utils.gsplit
local insert = table.insert
local kana_to_romaji = require("Module:Hrkt-translit").tr
local max_index = require("Module:table").maxIndex
local moraify = m_ja.moraify
local remove = table.remove
local ugmatch = mw.ustring.gmatch
local ugsub = m_str_utils.gsub
local ulen = m_str_utils.len
local ulower = m_str_utils.lower
local umatch = mw.ustring.match
local usub = m_str_utils.sub
local export = {}
local pos_functions = {}
local range = mw.loadData('Module:ja/data/range')
local Jpan = require("Module:scripts").getByCode("Jpan")
local function remove_links(text)
return (text:gsub("%[%[[^|%]]-|", "")
:gsub("%[%[", "")
:gsub("%]%]", ""))
end
local function assign_kana_to_kanji(head, kana, pagename, template_name)
-- TODO: uses deprecated module
local m_tu = require'Module:template utilities'
local kanji_pos = {[0] = {nil, 0}}
local head_nolink = {}
local link_border = 0
local function insert_kanji_pos(substr)
insert(head_nolink, substr)
for p1, w1 in ugmatch(substr, '()([々' .. range.kanji .. '])') do
p1 = byteoffset(substr, p1) + link_border
insert(kanji_pos, {p1, p1 + w1:len() - 1})
end
end
for p1, p2, w1 in m_tu.gfind_bracket(head, {['%[%['] = ']]'}) do
insert_kanji_pos(head:sub(link_border + 1, p1 - 1))
local p_pipe = w1:find'|' or 2
link_border = p1 + p_pipe - 1
insert_kanji_pos(w1:sub(p_pipe + 1, -3))
link_border = p2
end
insert_kanji_pos(head:sub(link_border + 1))
head_nolink = concat(head_nolink)
local pagetext = mw.title.new(pagename):getContent()
if not pagetext then return head, kana end
local non_kanji = {}
local last_kanji = 1
for p1 in ugmatch(head_nolink, '[々' .. range.kanji .. ']()') do
insert(non_kanji, usub(head_nolink, last_kanji, p1 - 2))
last_kanji = p1
end
insert(non_kanji, usub(head_nolink, last_kanji))
for kanjitab in pagetext:gmatch('(){{%s*' .. template_name) do
kanjitab = select(3, m_tu.find_bracket(pagetext, m_tu.brackets_temp, kanjitab))
if not kanjitab then error('ill-formed [[t:' .. template_name:gsub('%%', '') .. ']] syntax') end
kanjitab = m_tu.parse_temp(kanjitab)
local readings = {}
local readings_len = {}
for i = 1, max_index(kanjitab.args) do
local r_i = kanjitab.args[i] or ''
local r_o = kanjitab.args['o' .. i] or ''
if kanjitab.args['k' .. i] then
readings[i] = kanjitab.args['k' .. i] .. r_o
readings_len[i] = tonumber(r_i:match'^%s*%D*(%d*)%s*$') or 1
else
local r_kana, r_len = r_i:match'^%s*(%D*)(%d*)%s*$'
readings[i] = r_kana .. r_o
readings_len[i] = tonumber(r_len) or 1
end
end
local kana_decom = {}
local reading_id = 1
local reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(kana_decom, non_kanji[i])
insert(kana_decom, readings[reading_id])
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(kana_decom, non_kanji[#non_kanji])
local function strip_nonkana(str, repl)
return ugsub(str, '[^' .. range.kana .. ']+', repl) or nil
end
local xeno_reading = {strip_nonkana(kana, ''):match('^' .. strip_nonkana(concat(kana_decom), '(.-)') .. '$')}
if #xeno_reading > 0 then
local head_decom = {}
reading_id = 1
reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(head_decom, head:sub(kanji_pos[i - 1][2] + 1, kanji_pos[i][1] - 1))
insert(head_decom, head:sub(kanji_pos[i][1], kanji_pos[i + reading_len - 1][2]))
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(head_decom, head:sub(kanji_pos[#non_kanji - 1][2] + 1))
if #head_decom ~= #kana_decom then error('number of parameters in [[t:' .. template_name:gsub('%%', '') .. ']] is incorrect') end
local n_xeno_reading = 0
for i = 1, #kana_decom, 2 do
kana_decom[i] = ugsub(kana_decom[i], '[^' .. range.kana .. ']+', function()
n_xeno_reading = n_xeno_reading + 1
if xeno_reading[n_xeno_reading] == '' then return nil
else return xeno_reading[n_xeno_reading] end
end)
end
return concat(head_decom, '%'), concat(kana_decom, '%')
end
end
return head, kana
end
local en_grades = {
"ระดับ 1", "ระดับ 2", "ระดับ 3",
"ระดับ 4", "ระดับ 5", "ระดับ 6",
"ระดับมัธยมศึกษา", "จิมเมโย", "เฮียวไงจิ"
}
local aliases = {
['transitive']='tr', ['trans']='tr', ['สกรรม']='tr',
['intransitive']='in', ['intrans']='in', ['intr']='in', ['อกรรม']='in',
['godan']='1', ['ichidan']='2', ['irregular']='irr',
['โกดัง']='1', ['อิจิดัง']='2', ['ไม่ปรกติ']='irr'
}
local adverbs_optional_tag = 'optionally '
local adverbs_optional_aliases = {
['to']='と', ['と']='と', ['ト']='と',
['ni']='に', ['に']='に', ['ニ']='に',
}
local adverbs_optional_links = {
['と']='[[と#ภาษาญี่ปุ่น:_adverbs|と]]',
['に']='[[に]]',
}
local function formatting_adjustments(rom, kana, pos_category)
-- hyphens for prefixes, suffixes, and counters (classifiers)
if pos_category == "อุปสรรค" then
rom = rom:gsub('%-?$', '-')
elseif pos_category == "ปัจจัย" or pos_category == "รูปปัจจัย" or pos_category == "คำลักษณนาม" then
rom = rom:gsub('^%-?', '-')
elseif pos_category == "คำวิสามานยนาม" and not kana:match'%^' then -- automatic caps for proper nouns, if not already specified
rom = ugsub(ugsub(rom, '%f[^%s%c%p]%l', string.uupper), "%w'%u", ulower) -- no caps after medial apostrophes
end
return rom
end
local function kana_to_romaji_with_pos_format(kana, data, args)
if data.headword.pos_category == "combining forms" or data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" then
return "-"
end
local rom = remove_links(kana_to_romaji(kana, data.lang_code))
-- make adjustments for -u verbs and -i adjectives
if args['infl'] == '1' or args['infl'] == '1s' or args['infl'] == 'godan' then
rom = rom:gsub('ō$', 'ou'):gsub('ū$', 'uu')
elseif args['infl'] == 'i' or args['infl'] == 'is' or args['infl'] == 'い' then
rom = rom:gsub('ī$', 'ii')
end
return formatting_adjustments(rom, kana, data.headword.pos_category)
end
local function iterate_rare_chars(text)
local ch, i
return function()
repeat
ch, i = umatch(text, "([" .. range.kana .. range.kana_graph .. "!-/:-@%[\\-`×△○◎。-〠〶〷〻-〽・·゠=~][゙゚]*)()", i)
until not (ch and umatch(ch, "^[ぁ-ちっつて-ろんァ-チッツテ-ロンヲ-゚]$"))
return ch
end
end
local function historical_kana(data, hist_kana, modern_kana)
-- Disallow historical kana for kana and morae, as there's no one-to-one correspondence.
local pos = data.headword.pos_category
if pos == "พยางค์" or pos == "คานะ" or pos == "มอรา" then
error(("Cannot specify historical kana for %s."):format(pos))
end
local hist_kana_no_formatting = hist_kana:gsub("[%^%-%. %%]+", "")
local rare_chars, lang_name, hc = {}, data.lang_name, data.headword.categories
for ch in iterate_rare_chars(hist_kana_no_formatting) do
if not (modern_kana and modern_kana:find(ch)) then
rare_chars[ch] = true
end
end
for _, mora in ipairs(moraify((ugsub(hist_kana_no_formatting, "[^" .. range.kana .. "]+", " ")))) do
if not (mora:gsub(" +", ""):match("^.?[\128-\191]*$") or (modern_kana and modern_kana:find(mora))) then
rare_chars[mora] = true
end
end
for ch in pairs(rare_chars) do
insert(hc, lang_name .. " terms historically spelled with " .. ch)
end
insert(data.info_hist, require("Module:ja-link").link({
lang = data.headword.lang,
lemma = hist_kana,
tr = formatting_adjustments(
remove_links(kana_to_romaji(hist_kana, data.lang_code, nil, {hist = true})),
hist_kana,
pos
),
}, {
face = "head",
disableSelfLink = true,
}))
end
local function detect_pagename_kana(data, digraphs)
local pagename = data.pagename
-- Exclude "&" and "@", which are part of %p (e.g. リズム&ブルース).
local function remove_kana(m)
return m:match("[&@]") or ""
end
if ugsub(pagename, '[%p%s%c' .. range.hiragana .. (digraphs and "ゟ" or "") .. ']', remove_kana) == "" then
return 'hira'
elseif ugsub(pagename, '[%p%s%c' .. range.katakana .. (digraphs and "ヿ" or "") .. ']', remove_kana) == "" then
return 'kata'
elseif ugsub(pagename, '[%p%s%c' .. range.kana .. (digraphs and "ゟヿ" or "") .. ']', remove_kana) == "" then
return 'both'
end
end
-- go through args and build inflections by finding whatever kanas were given to us
local function format_headword(args, data)
local pagename, kanas, lang_name = data.pagename, data.kanas, data.lang_name
data.pagename_kana = detect_pagename_kana(data)
if args[1][1] and not args[1][1]:match'[\128-\255]' then
-- filter out POS designations
remove(args[1], 1)
end
local linked_translit = data.headword.lang:link_tr(Jpan)
local suru_ending, rom_suru_ending
if data.headword.pos_category == "คำกริยา する" then
suru_ending = "[[する]]"
rom_suru_ending = linked_translit and " [[suru]]" or " suru"
else
suru_ending, rom_suru_ending = "", ""
end
if data.pagename_kana then -- pure-kana-title entry
if #args.head > 0 or args.head.default then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
-- {{ja-xxx}} vs {{ja-xxx|こ.うし}} vs {{ja-xxx|コウシ}} in [[こうし]]
if not args[1][1] then
args[1][1] = pagename
elseif remove_links(args[1][1]:gsub("[%^%-%. %%]+", "")) ~= pagename then
insert(args[1], 1, pagename)
end
for i, k in ipairs(args[1]) do
insert(data.headword.heads, {
term = k:gsub("[%^%-%. %%]+", "") .. suru_ending,
tr = '-',
l = args.label[i] and {args.label[i]} or nil,
})
end
for i = 1, math.max(args.rom.maxindex, 1) do
local rom = args.rom[i] or args.rom.default or kana_to_romaji_with_pos_format(args[1][1], data, args)
if not data.headword.heads[i] then
data.headword.heads[i] = {term = data.headword.heads[i-1].term}
end
if rom == "-" then
data.headword.heads[i].tr = "-"
elseif linked_translit then
data.headword.heads[i].tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
data.headword.heads[i].tr = rom .. rom_suru_ending
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(args[i][1]:gsub("[%^%-%. %%]+", "")) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
kanas[1] = pagename
if args.hist[1] then
historical_kana(data, args.hist[1], args[1][1])
end
else -- non-pure-kana-title entry
if #args[1] == 0 and not (data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" or data.headword.pos_category == "สัญลักษณ์") then
error("Kana form is required.")
end
if args.head.default == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local rom_repetition_final = {}
for i, k in ipairs(args[1]) do
local rom_auto = kana_to_romaji_with_pos_format(k, data, args)
local head = args.head[i] or args.head.default or pagename
if args.head[i] == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local head_for_ruby, kana_for_ruby
if ulen(head) > 1 and head:match'%%' == nil and k:match'%%' == nil then
head_for_ruby, kana_for_ruby = assign_kana_to_kanji(head, k, pagename, data.lang_code .. '%-kanjitab')
else
head_for_ruby, kana_for_ruby = head, k
end
local format_table = m_ja_ruby.parse_text(head_for_ruby, kana_for_ruby, {
try = 'force',
try_force_limit = 10000,
})
local kana_bare = remove_links(k:gsub("[%^%-%. %%]+", ""))
local rom = args.rom[i] or args.rom.default or rom_auto
head = {
term = m_ja_ruby.to_wiki(format_table, {
break_link = true,
}):gsub('<rt>(..-)</rt>', "<rt>[[" .. kana_bare .."|%1]]</rt>") .. suru_ending,
l = args.label[i] and {args.label[i]} or nil,
}
if rom == "-" or rom_repetition_final[rom] then
head.tr = "-"
elseif linked_translit then
head.tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
head.tr = rom .. rom_suru_ending
end
insert(data.headword.heads, head)
rom_repetition_final[rom] = true
insert(kanas, kana_bare)
if args.hist[i] then
historical_kana(data, args.hist[i], k)
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(m_ja_ruby.to_markup(format_table)) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
local first_reading, multiple = kanas[1]
if not first_reading then
return
end
first_reading = ulower(kana_to_romaji(first_reading, data.lang_code)):gsub("%%", "")
for i = 2, #kanas do
if ulower(kana_to_romaji(kanas[i], data.lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
break
end
end
if not multiple then
local lang_code = data.lang_code
local content = mw.title.getCurrentTitle():getContent()
local loc1, loc2 = content:find("%f[^%z%s]==%s*" .. lang_name:gsub("%-", "%%%-") .. "%s*==()")
loc2 = content:find("%f[^%z%s]==[^\n=]+==", loc2)
if loc1 then
content = content:sub(loc1, loc2)
for template in require("Module:template parser").find_templates(content) do
local name, reading = template:get_name()
if (
name == lang_code .. "-head" or
name == lang_code .. "-pos"
) then
reading = template:get_arguments()[2]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif (
name == lang_code .. "-noun" or
name == lang_code .. "-verb" or
name == lang_code .. "-adj" or
name == lang_code .. "-phrase" or
name == lang_code .. "-verb form" or
name == lang_code .. "-verb-suru"
) then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif name == lang_code .. "-see" then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
-- if umatch(reading, "[^" .. range.kana .. "]") then
-- TODO: check linked page
-- end
end
if reading and ulower(kana_to_romaji(reading, lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
end
end
end
end
if multiple then
insert(data.headword.categories, lang_name .. " terms with multiple readings")
end
end
end
local function add_transitivity(data, tr)
local categories, lang_name = data.headword.categories, data.lang_name
tr = aliases[tr] or tr
if tr == "tr" then
insert(data.info_mid, 'สกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
elseif tr == "in" then
insert(data.info_mid, 'อกรรม')
insert(categories, "คำอกรรมกริยา" .. lang_name)
elseif tr == "both" then
insert(data.info_mid, 'สกรรมหรืออกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
insert(categories, "คำอกรรมกริยา" .. lang_name)
else
insert(categories, "คำกริยา" .. lang_name .. "ที่ไม่มีสกรรมลักษณะ")
end
end
local function get_final(lemma, data)
--return kana_to_romaji(remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma)))), data.lang_code)
return remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma))))
end
local function add_language_fragment(t, lang_name)
for k, v in ipairs(t) do
t[k] = v:gsub("%[%[([^]#]*)%]%]", function (s)
return "[[" .. s .. "#" .. lang_name .. "|" .. s .. "]]"
end)
end
end
local function add_inflections(data, inflection_type, cat_suffix)
local lang_name = data.lang_name
local lemma = data.inflection_base.form
local romaji = data.inflection_base.romaji
inflection_type = aliases[inflection_type] or inflection_type
local function replace_suffix(lemma_from, lemma_to, romaji_from, romaji_to)
-- e.g. 持って来る, lemma = "[持](も)って来(く)る"
-- lemma_from = "くる", lemma_to = {"き","きた"}
add_language_fragment(lemma_to, lang_name)
add_language_fragment(romaji_to, lang_name)
local result = {}
local pattern_from, n_from = lemma_from:gsub('.[\128-\191]*', function(c)
return '[' .. c .. m_ja.hira_to_kata(c) .. ']([^' .. range.kana .. ']*)'
end)
pattern_from = pattern_from .. '$'
-- "[くク]([^kana range]*)[るル]([^kana range]*)$"
for i_lemma_to, s_lemma_to in ipairs(lemma_to) do
local n_to = 0
local pattern_to = s_lemma_to:gsub('.[\128-\191]*', function(c)
if n_to < n_from then
n_to = n_to + 1
return c .. "%" .. n_to
else
return c
end
end)
for i = n_to + 1, n_from do
pattern_to = pattern_to .. "%" .. i
end
-- "き%1%2", "き%1た%2"
local lemma_inflected, success = ugsub(lemma, pattern_from, pattern_to)
if success == 0 then
return
end
local romaji_inflected
romaji_inflected, success = romaji:gsub(romaji_from .. "$", romaji_to[i_lemma_to])
if success == 0 then
romaji_inflected, success = romaji:gsub("%[%[" .. romaji_from .. "%]%]$", "[[" .. romaji_to[i_lemma_to] .. "]]")
if success == 0 then
return
end
end
insert(result, {lemma = lemma_inflected, romaji = romaji_inflected})
end
return result -- {{lemma="[持](も)って来(き)",romaji="motteki"},{lemma="[持](も)って来(き)た",romaji="mottekita"}}
end
local function insert_form(label, ...)
-- label = "stem" or "past" etc.
-- ... = {lemma=...,romaji=...},{lemma=...,romaji=...}
local labeled_forms = {label = label}
for _, v in ipairs{...} do
local table_form = m_ja_ruby.parse_markup(v.lemma)
local form_term = m_ja_ruby.to_wiki(table_form)
if not form_term:find'%[%[.+%]%]' then
form_term = '[[' .. m_ja_ruby.to_text(table_form) .. '#' .. lang_name .. '|' .. form_term .. ']]'
end
insert(labeled_forms, {
term = form_term,
tr = v.romaji,
})
end
insert(data.headword.inflections, labeled_forms)
end
local inflected_forms
if data.lang_code == 'ja' then
if inflection_type == '1' or inflection_type == '1s' then
insert(data.info_mid, '<abbr title="การผันรูปโกดัง (กลุ่ม 1)">โกดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if cat_suffix == "คำกริยา" then
local final = get_final(lemma, data)
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. final)
if final == "る" then
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぃる")
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぇる")
end
end
end
end
if inflection_type == '1' then
inflected_forms =
replace_suffix('く', {'き', 'いた'}, 'ku', {'ki', 'ita'}) or
replace_suffix('ぐ', {'ぎ', 'いだ'}, 'gu', {'gi', 'ida'}) or
replace_suffix('す', {'し', 'した'}, 'su', {'shi', 'shita'}) or
replace_suffix('つ', {'ち', 'った'}, 'tsu', {'chi', 'tta'}) or
replace_suffix('ぬ', {'に', 'んだ'}, 'nu', {'ni', 'nda'}) or
replace_suffix('ぶ', {'び', 'んだ'}, 'bu', {'bi', 'nda'}) or
replace_suffix('む', {'み', 'んだ'}, 'mu', {'mi', 'nda'}) or
replace_suffix('る', {'り', 'った'}, 'ru', {'ri', 'tta'}) or
replace_suffix('う', {'い', 'った'}, 'u', {'i', 'tta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
else
inflected_forms =
replace_suffix('る', {'り', 'った', 'い'}, 'ru', {'ri', 'tta', 'i'}) or --くださる
replace_suffix('いく', {'いき', 'いった'}, 'iku', {'iki', 'itta'}) or --行く
replace_suffix('う', {'い', 'うた'}, 'ou', {'oi', 'ōta'}) --問う
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1], inflected_forms[3])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
end
elseif inflection_type == '2' then
insert(data.info_mid, '<abbr title="การผันรูปอิจิดัง (กลุ่ม 2)">อิจิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "อิจิดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "คามิอิจิดัง" .. lang_name)
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "ชิโมอิจิดัง" .. lang_name)
else
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
end
inflected_forms = replace_suffix('る', {'', 'た'}, 'ru', {'', 'ta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'suru' then
insert(data.info_mid, '<abbr title="การผันรูปซูรุ (กลุ่ม 3)">ซูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " する " .. lang_name)
end
inflected_forms =
replace_suffix('する', {'し', 'した'}, 'suru', {'shi', 'shita'}) or
replace_suffix('ずる', {'じ', 'じた'}, 'zuru', {'ji', 'jita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'kuru' then
insert(data.info_mid, '<abbr title="การผันรูปคูรุ (กลุ่ม 3)">คูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " 来る " .. lang_name)
end
inflected_forms = replace_suffix('くる', {'き', 'きた'}, 'kuru', {'ki', 'kita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'i' or inflection_type == 'い' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('い', {'く'}, 'i', {'ku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'is' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('いい', {'よく'}, 'ii', {'yoku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'na' or inflection_type == 'な' then
insert(data.info_mid, '<abbr title="การผันรูป-นะ (ชนิด 1)">-นะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -な " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[な]]', '[[に]]'}, '', {' [[na]]', ' [[ni]]'})
insert_form('หน่วยนาม', inflected_forms[1])
insert_form('คำกริยาวิเศษณ์', inflected_forms[2])
elseif inflection_type == "yo" then
insert(data.info_mid, '<abbr title="การผันรูปโยดัง (คลาสสิก)"><sup><small>†</small></sup>โยดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. get_final(lemma, data))
end
elseif inflection_type == "kami ni" then
insert(data.info_mid, '<abbr title="การผันรูปคามินิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "คามินิดัง" .. lang_name)
end
elseif inflection_type == "shimo ni" then
insert(data.info_mid, '<abbr title="การผันรูปชิโมนิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "ชิโมนิดัง" .. lang_name)
end
elseif inflection_type == "rahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ริ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ริ</abbr>')
elseif inflection_type == "sahen" then
insert(data.info_mid, '<abbr title="การผันรูป-เซะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-เซะ</abbr>')
elseif inflection_type == "kahen" then
insert(data.info_mid, '<abbr title="การผันรูป-โกะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-โกะ</abbr>')
elseif inflection_type == "nahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ง พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ง</abbr>')
elseif inflection_type == "nari" or inflection_type == "なり" then
insert(data.info_mid, '<abbr title="การผันรูป-นาริ (คลาสสิก)"><sup><small>†</small></sup>-นาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -なり " .. lang_name)
end
elseif inflection_type == 'tari' or inflection_type == 'たり' then
insert(data.info_mid, '<abbr title="การผันรูป-ตาริ (คลาสสิก)"><sup><small>†</small></sup>-ตาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -たり " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[とした]]', '[[たる]]', '[[と]]', '[[として]]'}, '', {' [[to shita]]', ' [[taru]]', ' [[to]]', ' [[to shite]]'})
insert_form('หน่วยนาม', inflected_forms[1], inflected_forms[2])
insert_form('คำกริยาวิเศษณ์', inflected_forms[3], inflected_forms[4])
elseif inflection_type == "ku" or inflection_type == "く" then
insert(data.info_mid, '<abbr title="การผันรูป-กุ (คลาสสิก)"><sup><small>†</small></sup>-กุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -く " .. lang_name)
end
elseif inflection_type == "shiku" or inflection_type == "しく" then
insert(data.info_mid, '<abbr title="การผันรูป-ชิกุ (คลาสสิก)"><sup><small>†</small></sup>-ชิกุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -しく " .. lang_name)
end
elseif inflection_type == "ka" or inflection_type == "か" then
insert(data.info_mid, '<abbr title="การผันรูป-กะ (ภาษาถิ่น)"><sup><small>†</small></sup>-กะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -か " .. lang_name)
end
elseif inflection_type and inflection_type:len() > adverbs_optional_tag:len() and inflection_type:sub(1, adverbs_optional_tag:len()) == adverbs_optional_tag then
local adverbs_optional_list = inflection_type:sub(adverbs_optional_tag:len() + 1)
for option in gsplit(adverbs_optional_list, ':') do
local normalized_option = adverbs_optional_aliases[option]
if not normalized_option then
error('unrecognized adverb opt= argument: "' .. option .. '"')
end
local normalized_option_romaji = kana_to_romaji(normalized_option, data.lang_code)
local normalized_option_link = adverbs_optional_links[normalized_option]
inflected_forms = replace_suffix('', {normalized_option_link}, '', {' [[' .. normalized_option_romaji .. ']]'})
insert_form('optionally as', inflected_forms[1])
if cat_suffix then
insert(data.headword.categories, lang_name .. " " .. cat_suffix .. " optionally taking " .. normalized_option .. "-" .. normalized_option_romaji)
end
end
elseif inflection_type == 'irr' then
insert(data.info_mid, 'ไม่ปรกติ')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
elseif inflection_type == '-' or inflection_type == 'un' then
insert(data.info_mid, 'ผันรูปไม่ได้')
end
--elseif data.lang_code == 'ryu' then ...
end
end
local function add_categories(data)
local lang_name = data.lang_name
local pagename = data.pagename
local tc = data.headword.categories
-- adds category [langname] terms spelled with jōyō kanji or [langname] terms spelled with non-jōyō kanji
-- (if it contains any kanji)
local number_of_kanji = 0
for c in ugmatch(pagename, "[" .. range.kanji .. "々〻]") do
number_of_kanji = number_of_kanji + 1
if c ~= "々" and c ~= "〻" then -- Not a kanji for the purposes of categorisation.
insert(tc, ("ศัพท์" .. lang_name .. "ที่สะกดด้วยคันจิ%s"):format(en_grades[m_ja.kanji_grade(c)]))
end
end
if umatch(pagename, "[々〻]") then
insert(tc, "คำซ้ำ" .. lang_name)
end
-- categorize by number of kanji
if number_of_kanji ~= 0 then
insert(tc, ("ศัพท์" .. lang_name .. "ที่มีคันจิ %s ตัว"):format(number_of_kanji))
-- single-kanji terms
if ulen(pagename) == 1 then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. pagename)
insert(tc, "ศัพท์" .. lang_name .. "ที่มีคันจิ 1 ตัวเท่านั้น")
end
end
-- categorize by the script of the pagename or specific characters contained in it
-- if pagename is hiragana or katakana
if detect_pagename_kana(data, true) == 'hira' then insert(tc, "ฮิรางานะ" .. lang_name) end
if detect_pagename_kana(data, true) == 'kata' then insert(data.katakana_category, "คาตากานะ" .. lang_name) end
local p, n = ugsub(pagename, '[' .. range.kana .. range.kanji .. range.ideograph .. range.kana_graph .. range.punctuation .. ']+', '')
if p ~= '' and n > 0 then insert(tc, "ศัพท์" .. lang_name .. "ที่เขียนด้วยอักษรหลายชนิด") end
local pos = data.headword.pos_category
local rare_chars = {}
for ch in iterate_rare_chars(pagename) do
rare_chars[ch] = true
end
-- Categorise yōon, but exclude kana and mora entries, since they can't be spelled with themselves.
-- FIXME: allow kana categories for morae.
if not (pos == "พยางค์" or pos == "คานะ" or pos == "มอรา") then
for _, mora in ipairs(moraify((ugsub(pagename, "[^" .. range.kana .. "]+", " ")))) do
if not mora:gsub(" +", ""):match("^.?[\128-\191]*$") then
rare_chars[mora] = true
end
end
end
for ch in pairs(rare_chars) do
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. ch)
end
if (
pos ~= "สุภาษิต" and
pos ~= "วลี" and
umatch(ugsub(pagename, "[" .. range.katakana .. "]+", ""), "[" .. range.hiragana .. "]") and
umatch(ugsub(pagename, "[" .. range.hiragana .. "]+", ""), "[" .. range.katakana .. "]")
) then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วยคานะผสม")
end
end
pos_functions["คำกริยา"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, args["infl"], 'คำกริยา')
end
pos_functions["ปัจจัย"] = function(args, data)
add_inflections(data, args["infl"])
end
pos_functions["คำกริยาช่วย"] = function(args, data)
insert(data.headword.categories, "คำกริยาช่วย" .. data.lang_name)
add_inflections(data, args["infl"])
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำกริยา する"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, 'suru', 'คำกริยา')
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำคุณศัพท์"] = function(args, data)
add_inflections(data, args["infl"], 'คำคุณศัพท์')
end
pos_functions["คำนาม"] = function(args, data)
-- the counter (classifier) parameter, only relevant for nouns
local counter = args["count"] or ""
if counter == "-" then
insert(data.headword.inflections, {label = "นับไม่ได้"})
elseif counter ~= "" then
insert(data.headword.inflections, {label = "คำลักษณนาม", counter})
end
end
pos_functions["คำกริยาวิเศษณ์"] = function(args, data)
local opt = args["opt"]
if opt then
opt = adverbs_optional_tag .. opt
end
add_inflections(data, opt, 'คำกริยาวิเศษณ์')
end
--[==[
Generate categories by pagename, also optionally by POS
Also for use in soft redirect pages ([[Module:ja-see]]).
Sortkey is not provided.
data = {
pagename = ..., -- (required)
lang = ..., -- (required) language object
categories = {}, -- (required) receive categories
katakana_category = {}, -- (required) receive katakana-sorted categories
pos = ..., "noun", "verb", etc. no POS categories if not given
}
]==]
function export.cat(data)
--data.lang_name = data.lang:getCanonicalName()
data.lang_name = data.lang:getCategoryName()
data.pagename_kana = detect_pagename_kana(data)
if data.pos then
--local pos = data.pos:gsub('x$', 'xe') .. 's'
--insert(data.categories, data.lang_name .. ' ' .. pos)
--insert(data.categories, data.lang_name .. ' ' .. require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. 's')
local pos = data.pos
insert(data.categories, pos .. data.lang_name)
insert(data.categories, require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. data.lang_name)
end
data.headword = {categories = data.categories}
add_categories(data)
end
--[==[
The main entry point.
This is the only function that can be invoked from a template.
]==]
function export.show(frame)
local poscat = frame.args[2] or frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
-- หมวดหมู่เป็นภาษาไทย
local poscat_th = require("Module:th-utilities").th_pos(poscat)
local alias_of_hist = {alias_of = 'hist', list = false}
local alias_of_infl = {alias_of = "infl"}
local list = {list = true}
local list_allow_holes_separate_no_index = {list = true, allow_holes = true, separate_no_index = true}
local params = {
[1] = list,
['rom'] = list_allow_holes_separate_no_index,
['head'] = list_allow_holes_separate_no_index,
['label'] = {list = true, allow_holes = true},
['hist'] = list, ['hhira'] = alias_of_hist, ['hkata'] = alias_of_hist,
['tr'] = true,
['infl'] = true, ['type'] = alias_of_infl, ['decl'] = alias_of_infl,
['opt'] = true,
['count'] = true,
['sort'] = true,
['pagename'] = true,
}
-- For backwards compatibility with uses of {{ja-syllable}} with the script parameter.
if poscat_th == "พยางค์" then
params["sc"] = true
end
local args = require('Module:parameters').process(frame:getParent().args, params)
local data = {
headword = {
pos_category = poscat_th,
categories = {},
heads = {},
no_redundant_head_cat = true,
inflections = {},
genders = {'m'}, -- placeholder
nogendercat = true,
},
--custom info
pagename = args.pagename or mw.loadData("Module:headword/data").pagename,
pagename_kana = nil, -- "hira" "kata" "both", nil
lang_code = frame.args[1],
lang_name = nil, -- "Japanese", "Okinawan" ...
katakana_category = {},
info_mid = {}, -- "godan", "intransitive" ...
info_hist = {}, -- historical kana
inflection_base = {}, -- base of inflections
kanas = {}, -- kana id
}
data.headword.lang = require("Module:languages").getByCode(data.lang_code)
--data.lang_name = data.headword.lang:getCanonicalName()
data.lang_name = data.headword.lang:getCategoryName()
-- sort out all the kanas and do the romanization business
format_headword(args, data)
-- add certain inflections and categories for adjectives, verbs, nouns, or adverbs
if pos_functions[poscat_th] then
pos_functions[poscat_th](args, data)
end
-- categories
add_categories(data)
local sort_base = args.sort or data.kanas[1] or data.pagename
data.headword.sort_key = data.headword.lang:makeSortKey(sort_base)
local katakana_category = #data.katakana_category > 0 and
require("Module:utilities").format_categories(
data.katakana_category,
data.headword.lang,
nil,
sort_base,
nil,
require("Module:scripts").getByCode("Kana")
) or ""
-- output
local i_kanas = 0
return katakana_category .. require('Module:headword').full_headword(data.headword):gsub('<span class="gender">.-</span>', function()
return (#data.info_hist > 0 and '<sup>←' .. concat(data.info_hist, ' or ') .. '<sup>[[w:Historical kana orthography|?]]</sup></sup>' or '') .. ('<i>' .. concat(data.info_mid, ' ') .. '</i>')
end):gsub('<strong .->.-</strong>', function(m0)
i_kanas = i_kanas + 1
if data.kanas[i_kanas] then
return m0
end
end)
end
return export
jgzkcchud6di36rz3639xnnzqj1dha3
5759139
5759138
2026-08-26T05:36:13Z
Octahedron80
267
5759139
Scribunto
text/plain
local m_ja = require("Module:ja")
local m_ja_ruby = require("Module:ja-ruby")
local m_str_utils = require("Module:string utilities")
local byteoffset = mw.ustring.byteoffset
local concat = table.concat
local gsplit = m_str_utils.gsplit
local insert = table.insert
local kana_to_romaji = require("Module:Hrkt-translit").tr
local max_index = require("Module:table").maxIndex
local moraify = m_ja.moraify
local remove = table.remove
local ugmatch = mw.ustring.gmatch
local ugsub = m_str_utils.gsub
local ulen = m_str_utils.len
local ulower = m_str_utils.lower
local umatch = mw.ustring.match
local usub = m_str_utils.sub
local export = {}
local pos_functions = {}
local range = mw.loadData('Module:ja/data/range')
local Jpan = require("Module:scripts").getByCode("Jpan")
local function remove_links(text)
return (text:gsub("%[%[[^|%]]-|", "")
:gsub("%[%[", "")
:gsub("%]%]", ""))
end
local function assign_kana_to_kanji(head, kana, pagename, template_name)
-- TODO: uses deprecated module
local m_tu = require'Module:template utilities'
local kanji_pos = {[0] = {nil, 0}}
local head_nolink = {}
local link_border = 0
local function insert_kanji_pos(substr)
insert(head_nolink, substr)
for p1, w1 in ugmatch(substr, '()([々' .. range.kanji .. '])') do
p1 = byteoffset(substr, p1) + link_border
insert(kanji_pos, {p1, p1 + w1:len() - 1})
end
end
for p1, p2, w1 in m_tu.gfind_bracket(head, {['%[%['] = ']]'}) do
insert_kanji_pos(head:sub(link_border + 1, p1 - 1))
local p_pipe = w1:find'|' or 2
link_border = p1 + p_pipe - 1
insert_kanji_pos(w1:sub(p_pipe + 1, -3))
link_border = p2
end
insert_kanji_pos(head:sub(link_border + 1))
head_nolink = concat(head_nolink)
local pagetext = mw.title.new(pagename):getContent()
if not pagetext then return head, kana end
local non_kanji = {}
local last_kanji = 1
for p1 in ugmatch(head_nolink, '[々' .. range.kanji .. ']()') do
insert(non_kanji, usub(head_nolink, last_kanji, p1 - 2))
last_kanji = p1
end
insert(non_kanji, usub(head_nolink, last_kanji))
for kanjitab in pagetext:gmatch('(){{%s*' .. template_name) do
kanjitab = select(3, m_tu.find_bracket(pagetext, m_tu.brackets_temp, kanjitab))
if not kanjitab then error('ill-formed [[t:' .. template_name:gsub('%%', '') .. ']] syntax') end
kanjitab = m_tu.parse_temp(kanjitab)
local readings = {}
local readings_len = {}
for i = 1, max_index(kanjitab.args) do
local r_i = kanjitab.args[i] or ''
local r_o = kanjitab.args['o' .. i] or ''
if kanjitab.args['k' .. i] then
readings[i] = kanjitab.args['k' .. i] .. r_o
readings_len[i] = tonumber(r_i:match'^%s*%D*(%d*)%s*$') or 1
else
local r_kana, r_len = r_i:match'^%s*(%D*)(%d*)%s*$'
readings[i] = r_kana .. r_o
readings_len[i] = tonumber(r_len) or 1
end
end
local kana_decom = {}
local reading_id = 1
local reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(kana_decom, non_kanji[i])
insert(kana_decom, readings[reading_id])
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(kana_decom, non_kanji[#non_kanji])
local function strip_nonkana(str, repl)
return ugsub(str, '[^' .. range.kana .. ']+', repl) or nil
end
local xeno_reading = {strip_nonkana(kana, ''):match('^' .. strip_nonkana(concat(kana_decom), '(.-)') .. '$')}
if #xeno_reading > 0 then
local head_decom = {}
reading_id = 1
reading_len = 1
for i = 1, #non_kanji - 1 do
if reading_len <= 1 then
reading_len = readings_len[reading_id] or 1
insert(head_decom, head:sub(kanji_pos[i - 1][2] + 1, kanji_pos[i][1] - 1))
insert(head_decom, head:sub(kanji_pos[i][1], kanji_pos[i + reading_len - 1][2]))
reading_id = reading_id + 1
else
reading_len = reading_len - 1
end
end
insert(head_decom, head:sub(kanji_pos[#non_kanji - 1][2] + 1))
if #head_decom ~= #kana_decom then error('number of parameters in [[t:' .. template_name:gsub('%%', '') .. ']] is incorrect') end
local n_xeno_reading = 0
for i = 1, #kana_decom, 2 do
kana_decom[i] = ugsub(kana_decom[i], '[^' .. range.kana .. ']+', function()
n_xeno_reading = n_xeno_reading + 1
if xeno_reading[n_xeno_reading] == '' then return nil
else return xeno_reading[n_xeno_reading] end
end)
end
return concat(head_decom, '%'), concat(kana_decom, '%')
end
end
return head, kana
end
local en_grades = {
"ระดับ 1", "ระดับ 2", "ระดับ 3",
"ระดับ 4", "ระดับ 5", "ระดับ 6",
"ระดับมัธยมศึกษา", "จิมเมโย", "เฮียวไงจิ"
}
local aliases = {
['transitive']='tr', ['trans']='tr', ['สกรรม']='tr',
['intransitive']='in', ['intrans']='in', ['intr']='in', ['อกรรม']='in',
['godan']='1', ['ichidan']='2', ['irregular']='irr',
['โกดัง']='1', ['อิจิดัง']='2', ['ไม่ปรกติ']='irr'
}
local adverbs_optional_tag = 'optionally '
local adverbs_optional_aliases = {
['to']='と', ['と']='と', ['ト']='と',
['ni']='に', ['に']='に', ['ニ']='に',
}
local adverbs_optional_links = {
['と']='[[と#ภาษาญี่ปุ่น:_adverbs|と]]',
['に']='[[に]]',
}
local function formatting_adjustments(rom, kana, pos_category)
-- hyphens for prefixes, suffixes, and counters (classifiers)
if pos_category == "อุปสรรค" then
rom = rom:gsub('%-?$', '-')
elseif pos_category == "ปัจจัย" or pos_category == "รูปปัจจัย" or pos_category == "คำลักษณนาม" then
rom = rom:gsub('^%-?', '-')
elseif pos_category == "คำวิสามานยนาม" and not kana:match'%^' then -- automatic caps for proper nouns, if not already specified
rom = ugsub(ugsub(rom, '%f[^%s%c%p]%l', string.uupper), "%w'%u", ulower) -- no caps after medial apostrophes
end
return rom
end
local function kana_to_romaji_with_pos_format(kana, data, args)
if data.headword.pos_category == "combining forms" or data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" then
return "-"
end
local rom = remove_links(kana_to_romaji(kana, data.lang_code))
-- make adjustments for -u verbs and -i adjectives
if args['infl'] == '1' or args['infl'] == '1s' or args['infl'] == 'godan' then
rom = rom:gsub('ō$', 'ou'):gsub('ū$', 'uu')
elseif args['infl'] == 'i' or args['infl'] == 'is' or args['infl'] == 'い' then
rom = rom:gsub('ī$', 'ii')
end
return formatting_adjustments(rom, kana, data.headword.pos_category)
end
local function iterate_rare_chars(text)
local ch, i
return function()
repeat
ch, i = umatch(text, "([" .. range.kana .. range.kana_graph .. "!-/:-@%[\\-`×△○◎。-〠〶〷〻-〽・·゠=~][゙゚]*)()", i)
until not (ch and umatch(ch, "^[ぁ-ちっつて-ろんァ-チッツテ-ロンヲ-゚]$"))
return ch
end
end
local function historical_kana(data, hist_kana, modern_kana)
-- Disallow historical kana for kana and morae, as there's no one-to-one correspondence.
local pos = data.headword.pos_category
if pos == "พยางค์" or pos == "คานะ" or pos == "มอรา" then
error(("Cannot specify historical kana for %s."):format(pos))
end
local hist_kana_no_formatting = hist_kana:gsub("[%^%-%. %%]+", "")
local rare_chars, lang_name, hc = {}, data.lang_name, data.headword.categories
for ch in iterate_rare_chars(hist_kana_no_formatting) do
if not (modern_kana and modern_kana:find(ch)) then
rare_chars[ch] = true
end
end
for _, mora in ipairs(moraify((ugsub(hist_kana_no_formatting, "[^" .. range.kana .. "]+", " ")))) do
if not (mora:gsub(" +", ""):match("^.?[\128-\191]*$") or (modern_kana and modern_kana:find(mora))) then
rare_chars[mora] = true
end
end
for ch in pairs(rare_chars) do
insert(hc, lang_name .. " terms historically spelled with " .. ch)
end
insert(data.info_hist, require("Module:ja-link").link({
lang = data.headword.lang,
lemma = hist_kana,
tr = formatting_adjustments(
remove_links(kana_to_romaji(hist_kana, data.lang_code, nil, {hist = true})),
hist_kana,
pos
),
}, {
face = "head",
disableSelfLink = true,
}))
end
local function detect_pagename_kana(data, digraphs)
local pagename = data.pagename
-- Exclude "&" and "@", which are part of %p (e.g. リズム&ブルース).
local function remove_kana(m)
return m:match("[&@]") or ""
end
if ugsub(pagename, '[%p%s%c' .. range.hiragana .. (digraphs and "ゟ" or "") .. ']', remove_kana) == "" then
return 'hira'
elseif ugsub(pagename, '[%p%s%c' .. range.katakana .. (digraphs and "ヿ" or "") .. ']', remove_kana) == "" then
return 'kata'
elseif ugsub(pagename, '[%p%s%c' .. range.kana .. (digraphs and "ゟヿ" or "") .. ']', remove_kana) == "" then
return 'both'
end
end
-- go through args and build inflections by finding whatever kanas were given to us
local function format_headword(args, data)
local pagename, kanas, lang_name = data.pagename, data.kanas, data.lang_name
data.pagename_kana = detect_pagename_kana(data)
if args[1][1] and not args[1][1]:match'[\128-\255]' then
-- filter out POS designations
remove(args[1], 1)
end
local linked_translit = data.headword.lang:link_tr(Jpan)
local suru_ending, rom_suru_ending
if data.headword.pos_category == "คำกริยา する" then
suru_ending = "[[する]]"
rom_suru_ending = linked_translit and " [[suru]]" or " suru"
else
suru_ending, rom_suru_ending = "", ""
end
if data.pagename_kana then -- pure-kana-title entry
if #args.head > 0 or args.head.default then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
-- {{ja-xxx}} vs {{ja-xxx|こ.うし}} vs {{ja-xxx|コウシ}} in [[こうし]]
if not args[1][1] then
args[1][1] = pagename
elseif remove_links(args[1][1]:gsub("[%^%-%. %%]+", "")) ~= pagename then
insert(args[1], 1, pagename)
end
for i, k in ipairs(args[1]) do
insert(data.headword.heads, {
term = k:gsub("[%^%-%. %%]+", "") .. suru_ending,
tr = '-',
l = args.label[i] and {args.label[i]} or nil,
})
end
for i = 1, math.max(args.rom.maxindex, 1) do
local rom = args.rom[i] or args.rom.default or kana_to_romaji_with_pos_format(args[1][1], data, args)
if not data.headword.heads[i] then
data.headword.heads[i] = {term = data.headword.heads[i-1].term}
end
if rom == "-" then
data.headword.heads[i].tr = "-"
elseif linked_translit then
data.headword.heads[i].tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
data.headword.heads[i].tr = rom .. rom_suru_ending
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(args[i][1]:gsub("[%^%-%. %%]+", "")) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
kanas[1] = pagename
if args.hist[1] then
historical_kana(data, args.hist[1], args[1][1])
end
else -- non-pure-kana-title entry
if #args[1] == 0 and not (data.headword.pos_category == "เครื่องหมายวรรคตอน" or data.headword.pos_category == "เครื่องหมายซ้ำ" or data.headword.pos_category == "สัญลักษณ์") then
error("Kana form is required.")
end
if args.head.default == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local rom_repetition_final = {}
for i, k in ipairs(args[1]) do
local rom_auto = kana_to_romaji_with_pos_format(k, data, args)
local head = args.head[i] or args.head.default or pagename
if args.head[i] == pagename then
insert(data.headword.categories, lang_name .. " terms with redundant head parameter")
end
local head_for_ruby, kana_for_ruby
if ulen(head) > 1 and head:match'%%' == nil and k:match'%%' == nil then
head_for_ruby, kana_for_ruby = assign_kana_to_kanji(head, k, pagename, data.lang_code .. '%-kanjitab')
else
head_for_ruby, kana_for_ruby = head, k
end
local format_table = m_ja_ruby.parse_text(head_for_ruby, kana_for_ruby, {
try = 'force',
try_force_limit = 10000,
})
local kana_bare = remove_links(k:gsub("[%^%-%. %%]+", ""))
local rom = args.rom[i] or args.rom.default or rom_auto
head = {
term = m_ja_ruby.to_wiki(format_table, {
break_link = true,
}):gsub('<rt>(..-)</rt>', "<rt>[[" .. kana_bare .."|%1]]</rt>") .. suru_ending,
l = args.label[i] and {args.label[i]} or nil,
}
if rom == "-" or rom_repetition_final[rom] then
head.tr = "-"
elseif linked_translit then
head.tr = "[[" .. rom .. "]]" .. rom_suru_ending
else
head.tr = rom .. rom_suru_ending
end
insert(data.headword.heads, head)
rom_repetition_final[rom] = true
insert(kanas, kana_bare)
if args.hist[i] then
historical_kana(data, args.hist[i], k)
end
if not data.inflection_base.form then
data.inflection_base.form = remove_links(m_ja_ruby.to_markup(format_table)) .. suru_ending
data.inflection_base.romaji = rom .. rom_suru_ending
end
end
local first_reading, multiple = kanas[1]
if not first_reading then
return
end
first_reading = ulower(kana_to_romaji(first_reading, data.lang_code)):gsub("%%", "")
for i = 2, #kanas do
if ulower(kana_to_romaji(kanas[i], data.lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
break
end
end
if not multiple then
local lang_code = data.lang_code
local content = mw.title.getCurrentTitle():getContent()
local loc1, loc2 = content:find("%f[^%z%s]==%s*" .. lang_name:gsub("%-", "%%%-") .. "%s*==()")
loc2 = content:find("%f[^%z%s]==[^\n=]+==", loc2)
if loc1 then
content = content:sub(loc1, loc2)
for template in require("Module:template parser").find_templates(content) do
local name, reading = template:get_name()
if (
name == lang_code .. "-head" or
name == lang_code .. "-pos"
) then
reading = template:get_arguments()[2]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif (
name == lang_code .. "-noun" or
name == lang_code .. "-verb" or
name == lang_code .. "-adj" or
name == lang_code .. "-phrase" or
name == lang_code .. "-verb form" or
name == lang_code .. "-verb-suru"
) then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
elseif name == lang_code .. "-see" then
reading = template:get_arguments()[1]
if reading ~= nil then
reading = remove_links(reading):gsub("%%", "")
end
-- if umatch(reading, "[^" .. range.kana .. "]") then
-- TODO: check linked page
-- end
end
if reading and ulower(kana_to_romaji(reading, lang_code)):gsub("%%", "") ~= first_reading then
multiple = true
end
end
end
end
if multiple then
insert(data.headword.categories, lang_name .. " terms with multiple readings")
end
end
end
local function add_transitivity(data, tr)
local categories, lang_name = data.headword.categories, data.lang_name
tr = aliases[tr] or tr
if tr == "tr" then
insert(data.info_mid, 'สกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
elseif tr == "in" then
insert(data.info_mid, 'อกรรม')
insert(categories, "คำอกรรมกริยา" .. lang_name)
elseif tr == "both" then
insert(data.info_mid, 'สกรรมหรืออกรรม')
insert(categories, "คำสกรรมกริยา" .. lang_name)
insert(categories, "คำอกรรมกริยา" .. lang_name)
else
insert(categories, "คำกริยา" .. lang_name .. "ที่ไม่มีสกรรมลักษณะ")
end
end
local function get_final(lemma, data)
--return kana_to_romaji(remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma)))), data.lang_code)
return remove(moraify(m_ja_ruby.to_ruby(m_ja_ruby.parse_markup(lemma))))
end
local function add_language_fragment(t, lang_name)
for k, v in ipairs(t) do
t[k] = v:gsub("%[%[([^]#]*)%]%]", function (s)
return "[[" .. s .. "#" .. lang_name .. "|" .. s .. "]]"
end)
end
end
local function add_inflections(data, inflection_type, cat_suffix)
local lang_name = data.lang_name
local lemma = data.inflection_base.form
local romaji = data.inflection_base.romaji
inflection_type = aliases[inflection_type] or inflection_type
local function replace_suffix(lemma_from, lemma_to, romaji_from, romaji_to)
-- e.g. 持って来る, lemma = "[持](も)って来(く)る"
-- lemma_from = "くる", lemma_to = {"き","きた"}
add_language_fragment(lemma_to, lang_name)
add_language_fragment(romaji_to, lang_name)
local result = {}
local pattern_from, n_from = lemma_from:gsub('.[\128-\191]*', function(c)
return '[' .. c .. m_ja.hira_to_kata(c) .. ']([^' .. range.kana .. ']*)'
end)
pattern_from = pattern_from .. '$'
-- "[くク]([^kana range]*)[るル]([^kana range]*)$"
for i_lemma_to, s_lemma_to in ipairs(lemma_to) do
local n_to = 0
local pattern_to = s_lemma_to:gsub('.[\128-\191]*', function(c)
if n_to < n_from then
n_to = n_to + 1
return c .. "%" .. n_to
else
return c
end
end)
for i = n_to + 1, n_from do
pattern_to = pattern_to .. "%" .. i
end
-- "き%1%2", "き%1た%2"
local lemma_inflected, success = ugsub(lemma, pattern_from, pattern_to)
if success == 0 then
return
end
local romaji_inflected
romaji_inflected, success = romaji:gsub(romaji_from .. "$", romaji_to[i_lemma_to])
if success == 0 then
romaji_inflected, success = romaji:gsub("%[%[" .. romaji_from .. "%]%]$", "[[" .. romaji_to[i_lemma_to] .. "]]")
if success == 0 then
return
end
end
insert(result, {lemma = lemma_inflected, romaji = romaji_inflected})
end
return result -- {{lemma="[持](も)って来(き)",romaji="motteki"},{lemma="[持](も)って来(き)た",romaji="mottekita"}}
end
local function insert_form(label, ...)
-- label = "stem" or "past" etc.
-- ... = {lemma=...,romaji=...},{lemma=...,romaji=...}
local labeled_forms = {label = label}
for _, v in ipairs{...} do
local table_form = m_ja_ruby.parse_markup(v.lemma)
local form_term = m_ja_ruby.to_wiki(table_form)
if not form_term:find'%[%[.+%]%]' then
form_term = '[[' .. m_ja_ruby.to_text(table_form) .. '#' .. lang_name .. '|' .. form_term .. ']]'
end
insert(labeled_forms, {
term = form_term,
tr = v.romaji,
})
end
insert(data.headword.inflections, labeled_forms)
end
local inflected_forms
if data.lang_code == 'ja' then
if inflection_type == '1' or inflection_type == '1s' then
insert(data.info_mid, '<abbr title="การผันรูปโกดัง (กลุ่ม 1)">โกดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if cat_suffix == "คำกริยา" then
local final = get_final(lemma, data)
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. final)
if final == "る" then
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぃる")
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "โกดัง" .. lang_name .. "ที่ลงท้ายด้วย -ぇる")
end
end
end
end
if inflection_type == '1' then
inflected_forms =
replace_suffix('く', {'き', 'いた'}, 'ku', {'ki', 'ita'}) or
replace_suffix('ぐ', {'ぎ', 'いだ'}, 'gu', {'gi', 'ida'}) or
replace_suffix('す', {'し', 'した'}, 'su', {'shi', 'shita'}) or
replace_suffix('つ', {'ち', 'った'}, 'tsu', {'chi', 'tta'}) or
replace_suffix('ぬ', {'に', 'んだ'}, 'nu', {'ni', 'nda'}) or
replace_suffix('ぶ', {'び', 'んだ'}, 'bu', {'bi', 'nda'}) or
replace_suffix('む', {'み', 'んだ'}, 'mu', {'mi', 'nda'}) or
replace_suffix('る', {'り', 'った'}, 'ru', {'ri', 'tta'}) or
replace_suffix('う', {'い', 'った'}, 'u', {'i', 'tta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
else
inflected_forms =
replace_suffix('る', {'り', 'った', 'い'}, 'ru', {'ri', 'tta', 'i'}) or --くださる
replace_suffix('いく', {'いき', 'いった'}, 'iku', {'iki', 'itta'}) or --行く
replace_suffix('う', {'い', 'うた'}, 'ou', {'oi', 'ōta'}) --問う
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1], inflected_forms[3])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
end
elseif inflection_type == '2' then
insert(data.info_mid, '<abbr title="การผันรูปอิจิดัง (กลุ่ม 2)">อิจิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "อิจิดัง" .. lang_name)
local romaji = data.inflection_base.romaji
if umatch(romaji, "[iIīĪ]ru$") then
insert(data.headword.categories, cat_suffix .. "คามิอิจิดัง" .. lang_name)
elseif umatch(romaji, "[eEēĒ]ru$") then
insert(data.headword.categories, cat_suffix .. "ชิโมอิจิดัง" .. lang_name)
else
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
end
inflected_forms = replace_suffix('る', {'', 'た'}, 'ru', {'', 'ta'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'suru' then
insert(data.info_mid, '<abbr title="การผันรูปซูรุ (กลุ่ม 3)">ซูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " する " .. lang_name)
end
inflected_forms =
replace_suffix('する', {'し', 'した'}, 'suru', {'shi', 'shita'}) or
replace_suffix('ずる', {'じ', 'じた'}, 'zuru', {'ji', 'jita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'kuru' then
insert(data.info_mid, '<abbr title="การผันรูปคูรุ (กลุ่ม 3)">คูรุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " 来る " .. lang_name)
end
inflected_forms = replace_suffix('くる', {'き', 'きた'}, 'kuru', {'ki', 'kita'})
if inflected_forms then
insert_form('ต้นเค้าศัพท์', inflected_forms[1])
insert_form('อดีตกาล', inflected_forms[2])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'i' or inflection_type == 'い' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('い', {'く'}, 'i', {'ku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'is' then
insert(data.info_mid, '<abbr title="การผันรูป-อิ (ชนิด 1)">-อิ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -い " .. lang_name)
end
inflected_forms = replace_suffix('いい', {'よく'}, 'ii', {'yoku'})
if inflected_forms then
insert_form('คำกริยาวิเศษณ์', inflected_forms[1])
else
require'Module:debug'.track'Jpan-headword/inflection failed/ja'
end
elseif inflection_type == 'na' or inflection_type == 'な' then
insert(data.info_mid, '<abbr title="การผันรูป-นะ (ชนิด 1)">-นะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -な " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[な]]', '[[に]]'}, '', {' [[na]]', ' [[ni]]'})
insert_form('หน่วยนาม', inflected_forms[1])
insert_form('คำกริยาวิเศษณ์', inflected_forms[2])
elseif inflection_type == "yo" then
insert(data.info_mid, '<abbr title="การผันรูปโยดัง (คลาสสิก)"><sup><small>†</small></sup>โยดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "โยดัง" .. lang_name .. "ที่ลงท้ายด้วย -" .. get_final(lemma, data))
end
elseif inflection_type == "kami ni" then
insert(data.info_mid, '<abbr title="การผันรูปคามินิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "คามินิดัง" .. lang_name)
end
elseif inflection_type == "shimo ni" then
insert(data.info_mid, '<abbr title="การผันรูปชิโมนิดัง (คลาสสิก)"><sup><small>†</small></sup>นิดัง</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "นิดัง" .. lang_name)
insert(data.headword.categories, cat_suffix .. "ชิโมนิดัง" .. lang_name)
end
elseif inflection_type == "rahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ริ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ริ</abbr>')
elseif inflection_type == "sahen" then
insert(data.info_mid, '<abbr title="การผันรูป-เซะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-เซะ</abbr>')
elseif inflection_type == "kahen" then
insert(data.info_mid, '<abbr title="การผันรูป-โกะ พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-โกะ</abbr>')
elseif inflection_type == "nahen" then
insert(data.info_mid, '<abbr title="การผันรูป-ง พิเศษ (คลาสสิก)"><sup><small>†</small></sup>-ง</abbr>')
elseif inflection_type == "nari" or inflection_type == "なり" then
insert(data.info_mid, '<abbr title="การผันรูป-นาริ (คลาสสิก)"><sup><small>†</small></sup>-นาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -なり " .. lang_name)
end
elseif inflection_type == 'tari' or inflection_type == 'たり' then
insert(data.info_mid, '<abbr title="การผันรูป-ตาริ (คลาสสิก)"><sup><small>†</small></sup>-ตาริ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -たり " .. lang_name)
end
inflected_forms = replace_suffix('', {'[[とした]]', '[[たる]]', '[[と]]', '[[として]]'}, '', {' [[to shita]]', ' [[taru]]', ' [[to]]', ' [[to shite]]'})
insert_form('หน่วยนาม', inflected_forms[1], inflected_forms[2])
insert_form('คำกริยาวิเศษณ์', inflected_forms[3], inflected_forms[4])
elseif inflection_type == "ku" or inflection_type == "く" then
insert(data.info_mid, '<abbr title="การผันรูป-กุ (คลาสสิก)"><sup><small>†</small></sup>-กุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -く " .. lang_name)
end
elseif inflection_type == "shiku" or inflection_type == "しく" then
insert(data.info_mid, '<abbr title="การผันรูป-ชิกุ (คลาสสิก)"><sup><small>†</small></sup>-ชิกุ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -しく " .. lang_name)
end
elseif inflection_type == "ka" or inflection_type == "か" then
insert(data.info_mid, '<abbr title="การผันรูป-กะ (ภาษาถิ่น)"><sup><small>†</small></sup>-กะ</abbr>')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. " -か " .. lang_name)
end
elseif inflection_type and inflection_type:len() > adverbs_optional_tag:len() and inflection_type:sub(1, adverbs_optional_tag:len()) == adverbs_optional_tag then
local adverbs_optional_list = inflection_type:sub(adverbs_optional_tag:len() + 1)
for option in gsplit(adverbs_optional_list, ':') do
local normalized_option = adverbs_optional_aliases[option]
if not normalized_option then
error('unrecognized adverb opt= argument: "' .. option .. '"')
end
local normalized_option_romaji = kana_to_romaji(normalized_option, data.lang_code)
local normalized_option_link = adverbs_optional_links[normalized_option]
inflected_forms = replace_suffix('', {normalized_option_link}, '', {' [[' .. normalized_option_romaji .. ']]'})
insert_form('optionally as', inflected_forms[1])
if cat_suffix then
insert(data.headword.categories, lang_name .. " " .. cat_suffix .. " optionally taking " .. normalized_option .. "-" .. normalized_option_romaji)
end
end
elseif inflection_type == 'irr' then
insert(data.info_mid, 'ไม่ปรกติ')
if cat_suffix then
insert(data.headword.categories, cat_suffix .. "ไม่ปรกติ" .. lang_name)
end
elseif inflection_type == '-' or inflection_type == 'un' then
insert(data.info_mid, 'ผันรูปไม่ได้')
end
--elseif data.lang_code == 'ryu' then ...
end
end
local function add_categories(data)
local lang_name = data.lang_name
local pagename = data.pagename
local tc = data.headword.categories
-- adds category [langname] terms spelled with jōyō kanji or [langname] terms spelled with non-jōyō kanji
-- (if it contains any kanji)
local number_of_kanji = 0
for c in ugmatch(pagename, "[" .. range.kanji .. "々〻]") do
number_of_kanji = number_of_kanji + 1
if c ~= "々" and c ~= "〻" then -- Not a kanji for the purposes of categorisation.
insert(tc, ("ศัพท์" .. lang_name .. "ที่สะกดด้วยคันจิ%s"):format(en_grades[m_ja.kanji_grade(c)]))
end
end
if umatch(pagename, "[々〻]") and pagename ~= "々" and pagename ~= "〻" then
insert(tc, "คำซ้ำ" .. lang_name)
end
-- categorize by number of kanji
if number_of_kanji ~= 0 then
insert(tc, ("ศัพท์" .. lang_name .. "ที่มีคันจิ %s ตัว"):format(number_of_kanji))
-- single-kanji terms
if ulen(pagename) == 1 then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. pagename)
insert(tc, "ศัพท์" .. lang_name .. "ที่มีคันจิ 1 ตัวเท่านั้น")
end
end
-- categorize by the script of the pagename or specific characters contained in it
-- if pagename is hiragana or katakana
if detect_pagename_kana(data, true) == 'hira' then insert(tc, "ฮิรางานะ" .. lang_name) end
if detect_pagename_kana(data, true) == 'kata' then insert(data.katakana_category, "คาตากานะ" .. lang_name) end
local p, n = ugsub(pagename, '[' .. range.kana .. range.kanji .. range.ideograph .. range.kana_graph .. range.punctuation .. ']+', '')
if p ~= '' and n > 0 then insert(tc, "ศัพท์" .. lang_name .. "ที่เขียนด้วยอักษรหลายชนิด") end
local pos = data.headword.pos_category
local rare_chars = {}
for ch in iterate_rare_chars(pagename) do
rare_chars[ch] = true
end
-- Categorise yōon, but exclude kana and mora entries, since they can't be spelled with themselves.
-- FIXME: allow kana categories for morae.
if not (pos == "พยางค์" or pos == "คานะ" or pos == "มอรา") then
for _, mora in ipairs(moraify((ugsub(pagename, "[^" .. range.kana .. "]+", " ")))) do
if not mora:gsub(" +", ""):match("^.?[\128-\191]*$") then
rare_chars[mora] = true
end
end
end
for ch in pairs(rare_chars) do
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วย " .. ch)
end
if (
pos ~= "สุภาษิต" and
pos ~= "วลี" and
umatch(ugsub(pagename, "[" .. range.katakana .. "]+", ""), "[" .. range.hiragana .. "]") and
umatch(ugsub(pagename, "[" .. range.hiragana .. "]+", ""), "[" .. range.katakana .. "]")
) then
insert(tc, "ศัพท์" .. lang_name .. "ที่สะกดด้วยคานะผสม")
end
end
pos_functions["คำกริยา"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, args["infl"], 'คำกริยา')
end
pos_functions["ปัจจัย"] = function(args, data)
add_inflections(data, args["infl"])
end
pos_functions["คำกริยาช่วย"] = function(args, data)
insert(data.headword.categories, "คำกริยาช่วย" .. data.lang_name)
add_inflections(data, args["infl"])
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำกริยา する"] = function(args, data)
add_transitivity(data, args["tr"])
add_inflections(data, 'suru', 'คำกริยา')
data.headword.pos_category = "คำกริยา"
end
pos_functions["คำคุณศัพท์"] = function(args, data)
add_inflections(data, args["infl"], 'คำคุณศัพท์')
end
pos_functions["คำนาม"] = function(args, data)
-- the counter (classifier) parameter, only relevant for nouns
local counter = args["count"] or ""
if counter == "-" then
insert(data.headword.inflections, {label = "นับไม่ได้"})
elseif counter ~= "" then
insert(data.headword.inflections, {label = "คำลักษณนาม", counter})
end
end
pos_functions["คำกริยาวิเศษณ์"] = function(args, data)
local opt = args["opt"]
if opt then
opt = adverbs_optional_tag .. opt
end
add_inflections(data, opt, 'คำกริยาวิเศษณ์')
end
--[==[
Generate categories by pagename, also optionally by POS
Also for use in soft redirect pages ([[Module:ja-see]]).
Sortkey is not provided.
data = {
pagename = ..., -- (required)
lang = ..., -- (required) language object
categories = {}, -- (required) receive categories
katakana_category = {}, -- (required) receive katakana-sorted categories
pos = ..., "noun", "verb", etc. no POS categories if not given
}
]==]
function export.cat(data)
--data.lang_name = data.lang:getCanonicalName()
data.lang_name = data.lang:getCategoryName()
data.pagename_kana = detect_pagename_kana(data)
if data.pos then
--local pos = data.pos:gsub('x$', 'xe') .. 's'
--insert(data.categories, data.lang_name .. ' ' .. pos)
--insert(data.categories, data.lang_name .. ' ' .. require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. 's')
local pos = data.pos
insert(data.categories, pos .. data.lang_name)
insert(data.categories, require'Module:headword'.pos_lemma_or_nonlemma(pos, true) .. data.lang_name)
end
data.headword = {categories = data.categories}
add_categories(data)
end
--[==[
The main entry point.
This is the only function that can be invoked from a template.
]==]
function export.show(frame)
local poscat = frame.args[2] or frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
-- หมวดหมู่เป็นภาษาไทย
local poscat_th = require("Module:th-utilities").th_pos(poscat)
local alias_of_hist = {alias_of = 'hist', list = false}
local alias_of_infl = {alias_of = "infl"}
local list = {list = true}
local list_allow_holes_separate_no_index = {list = true, allow_holes = true, separate_no_index = true}
local params = {
[1] = list,
['rom'] = list_allow_holes_separate_no_index,
['head'] = list_allow_holes_separate_no_index,
['label'] = {list = true, allow_holes = true},
['hist'] = list, ['hhira'] = alias_of_hist, ['hkata'] = alias_of_hist,
['tr'] = true,
['infl'] = true, ['type'] = alias_of_infl, ['decl'] = alias_of_infl,
['opt'] = true,
['count'] = true,
['sort'] = true,
['pagename'] = true,
}
-- For backwards compatibility with uses of {{ja-syllable}} with the script parameter.
if poscat_th == "พยางค์" then
params["sc"] = true
end
local args = require('Module:parameters').process(frame:getParent().args, params)
local data = {
headword = {
pos_category = poscat_th,
categories = {},
heads = {},
no_redundant_head_cat = true,
inflections = {},
genders = {'m'}, -- placeholder
nogendercat = true,
},
--custom info
pagename = args.pagename or mw.loadData("Module:headword/data").pagename,
pagename_kana = nil, -- "hira" "kata" "both", nil
lang_code = frame.args[1],
lang_name = nil, -- "Japanese", "Okinawan" ...
katakana_category = {},
info_mid = {}, -- "godan", "intransitive" ...
info_hist = {}, -- historical kana
inflection_base = {}, -- base of inflections
kanas = {}, -- kana id
}
data.headword.lang = require("Module:languages").getByCode(data.lang_code)
--data.lang_name = data.headword.lang:getCanonicalName()
data.lang_name = data.headword.lang:getCategoryName()
-- sort out all the kanas and do the romanization business
format_headword(args, data)
-- add certain inflections and categories for adjectives, verbs, nouns, or adverbs
if pos_functions[poscat_th] then
pos_functions[poscat_th](args, data)
end
-- categories
add_categories(data)
local sort_base = args.sort or data.kanas[1] or data.pagename
data.headword.sort_key = data.headword.lang:makeSortKey(sort_base)
local katakana_category = #data.katakana_category > 0 and
require("Module:utilities").format_categories(
data.katakana_category,
data.headword.lang,
nil,
sort_base,
nil,
require("Module:scripts").getByCode("Kana")
) or ""
-- output
local i_kanas = 0
return katakana_category .. require('Module:headword').full_headword(data.headword):gsub('<span class="gender">.-</span>', function()
return (#data.info_hist > 0 and '<sup>←' .. concat(data.info_hist, ' or ') .. '<sup>[[w:Historical kana orthography|?]]</sup></sup>' or '') .. ('<i>' .. concat(data.info_mid, ' ') .. '</i>')
end):gsub('<strong .->.-</strong>', function(m0)
i_kanas = i_kanas + 1
if data.kanas[i_kanas] then
return m0
end
end)
end
return export
o7hrkbgmb09mx7rta0syotjxgmfvdpa
สฐะ
0
40714
5759147
1775180
2026-08-26T09:45:25Z
Jamnanja
16523
/* รากศัพท์ */
5759147
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{bor+|th|pi|สฐ}}; เทียบ{{cog|sa|शठ}} (ซึ่งยืมมาเป็น{{cog|th|ศฐะ}})
=== การออกเสียง ===
{{th-pron|สะ-ถะ}}
=== คำคุณศัพท์ ===
{{th-adj|-}}
# {{lb|th|กลอน}} [[โกง]], [[ล่อลวง]]
# {{lb|th|กลอน}} [[โอ้อวด]]
f8wk85exqrrmuj81o86exxapcfomqyy
predisposition
0
41527
5759118
1615419
2026-08-25T14:22:08Z
Alifshinobi
397
5759118
wikitext
text/x-wiki
== ภาษาอังกฤษ ==
===การออกเสียง===
*{{IPA|en|/pɹiˌdɪspəˈzɪʃən/}}
=== {{หน้าที่|en|นาม}} ===
{{en-noun}} (พรีดิสพะซิฌัน)
# [[ปัจจัยโน้มเอียง]]
# [[ความมี]][[ใจ]][[โน้ม]][[เอียง]]
ko5xs4ifk4zhxtwjz1dl2er9f51m403
มอดูล:etymology
828
135442
5759135
5714209
2026-08-26T04:42:38Z
Octahedron80
267
5759135
Scribunto
text/plain
local export = {}
-- For testing
local force_cat = false
local debug_track_module = "Module:debug/track"
local languages_module = "Module:languages"
local links_module = "Module:links"
local pron_qualifier_module = "Module:pron qualifier"
local table_module = "Module:table"
local utilities_module = "Module:utilities"
local concat = table.concat
local insert = table.insert
local new_title = mw.title.new
local function debug_track(...)
debug_track = require(debug_track_module)
return debug_track(...)
end
local function format_categories(...)
format_categories = require(utilities_module).format_categories
return format_categories(...)
end
local function format_qualifiers(...)
format_qualifiers = require(pron_qualifier_module).format_qualifiers
return format_qualifiers(...)
end
local function full_link(...)
full_link = require(links_module).full_link
return full_link(...)
end
local function get_language_data_module_name(...)
get_language_data_module_name = require(languages_module).getDataModuleName
return get_language_data_module_name(...)
end
local function get_link_page(...)
get_link_page = require(links_module).get_link_page
return get_link_page(...)
end
local function language_link(...)
language_link = require(links_module).language_link
return language_link(...)
end
local function serial_comma_join(...)
serial_comma_join = require(table_module).serialCommaJoin
return serial_comma_join(...)
end
local function shallow_copy(...)
shallow_copy = require(table_module).shallowCopy
return shallow_copy(...)
end
local function track(page, code)
local tracking_page = "etymology/" .. page
debug_track(tracking_page)
if code then
debug_track(tracking_page .. "/" .. code)
end
end
local function join_segs(segs, conj)
if not segs[2] then
return segs[1]
elseif conj == "และ" or conj == "หรือ" then
return serial_comma_join(segs, {conj = conj})
end
local sep
if conj == "," or conj == ";" then
sep = conj .. " "
elseif conj == "/" then
sep = "/"
elseif conj == "~" then
sep = " ~ "
elseif conj then
error(("Internal error: Unrecognized conjunction \"%s\""):format(conj))
else
error(("Internal error: No value supplied for conjunction"):format(conj))
end
return concat(segs, sep)
end
-- Returns true if `lang` is the same as `source`, or a variety of it.
local function lang_is_source(lang, source)
return lang:getCode() == source:getCode() or lang:hasParent(source)
end
--[==[
Format one or more links as specified in `termobjs`, a list of term objects of the format accepted by `full_link()` in
[[Module:links]], additionally with optional qualifiers, labels and references. `conj` is used to join multiple terms
and must be specified if there is more than one term. `template_name` is the template name used in debug tracking and
must be specified. Optional `sourcetext` is text to prepend to the concatenated terms, separated by a space if the
concatenated terms are non-empty (which is always the case unless there is a single term with the value "-"). If
`qualifiers_labels_on_outside` is given, any qualifiers, labels or references specified in the first term go on the
outside of (i.e before) `sourcetext`; otherwise they will end up on the inside.
]==]
function export.format_links(termobjs, conj, template_name, sourcetext, qualifiers_labels_on_outside)
if not template_name then
error("Internal error: Must specify `template_name` to format_links()")
end
for i, termobj in ipairs(termobjs) do
if termobj.lang:hasType("family") or termobj.lang:getFamilyCode() == "qfa-sub" then
if termobj.term and termobj.term ~= "-" then
debug_track(template_name .. "/family-with-term")
end
termobj.term = "-"
end
if termobj.term == "-" then
--[=[
[[Special:WhatLinksHere/Wiktionary:Tracking/cognate/no-term]]
[[Special:WhatLinksHere/Wiktionary:Tracking/derived/no-term]]
[[Special:WhatLinksHere/Wiktionary:Tracking/borrowed/no-term]]
[[Special:WhatLinksHere/Wiktionary:Tracking/calque/no-term]]
]=]
debug_track(template_name .. "/no-term")
termobjs[i] = i == 1 and sourcetext or ""
else
if i == 1 and qualifiers_labels_on_outside and sourcetext then
termobj.pretext = sourcetext .. " "
sourcetext = nil
end
termobjs[i] = (i == 1 and sourcetext and sourcetext .. " " or "") ..
full_link(termobj, "term", nil, "show qualifiers")
end
end
return join_segs(termobjs, conj)
end
function export.get_display_and_cat_name(source, raw)
local display, cat_name
if source:getCode() == "und" then
display = "ยังไม่กำหนด"
cat_name = "ภาษาอื่น"
elseif source:getCode() == "mul" then
display = raw and "ร่วม" or "[[w:ภาษาร่วม|ภาษาร่วม]]"
cat_name = "ภาษาร่วม"
elseif source:getCode() == "mul-tax" then
display = raw and "ชื่ออนุกรมวิธาน" or "[[w:การตั้งชื่อทวินาม|ชื่ออนุกรมวิธาน]]"
cat_name = "ชื่ออนุกรมวิธาน"
else
display = raw and source:getCanonicalName() or source:makeWikipediaLink()
cat_name = "ภาษา" .. source:getDisplayForm()
end
return display, cat_name
end
function export.insert_source_cat_get_display(data)
local categories, lang, source = data.categories, data.lang, data.source
local display, cat_name = export.get_display_and_cat_name(source, data.raw)
if lang and not data.nocat then
-- Add the category, but only if there is a current language
if not categories then
categories = {}
end
local langname = lang:getFullName()
-- If `lang` is an etym-only language, we need to check both it and its parent full language against `source`.
-- Otherwise if e.g. `lang` is Medieval Latin and `source` is Latin, we'll end up wrongly constructing a
-- category 'Latin terms derived from Latin'.
--insert(categories, langname .. (
-- lang_is_source(lang, source) and " terms borrowed back into " .. cat_name or
-- " " .. (data.borrowing_type or "terms derived") .. " from " .. cat_name
--))
insert(categories, "ศัพท์ภาษา" .. langname .. (
lang_is_source(lang, source) and "ที่ยืมกลับไปยัง" .. cat_name or
"ที่" .. (data.borrowing_type or "รับมา") .. "จาก" .. cat_name
))
end
return display, categories
end
function export.format_source(data)
local lang, sort_key = data.lang, data.sort_key
-- [[Special:WhatLinksHere/Wiktionary:Tracking/etymology/sortkey]]
if sort_key then
track("sortkey")
end
local display, categories = export.insert_source_cat_get_display(data)
if lang and not data.nocat then
-- Format categories, but only if there is a current language; {{cog}} currently gets no categories
categories = format_categories(categories, lang, sort_key, nil, data.force_cat or force_cat)
else
categories = ""
end
return "<span class=\"etyl\">" .. display .. categories .. "</span>"
end
--[==[
Format sources for etymology templates such as {{tl|bor}}, {{tl|der}}, {{tl|inh}} and {{tl|cog}}. There may potentially
be more than one source language (except currently {{tl|inh}}, which doesn't support it because it doesn't really
make sense). In that case, all but the last source language is linked to the first term, but only if there is such a
term and this linking makes sense, i.e. either (1) the term page exists after stripping diacritics according to the
source language in question, or (2) the result of stripping diacritics according to the source language in question
results in a different page from the same process applied with the last source language. For example, {{m|ru|соля́нка}}
will link to [[солянка]] but {{m|en|соля́нка}} will link to [[соля́нка]] with an accent, and since they are different
pages, the use of English as a non-final source with term 'соля́нка' will link to [[соля́нка]] even though it doesn't
exist, on the assumption that it is merely a redlink that might exist. If none of the above criteria apply, a non-final
source language will be linked to the Wikipedia entry for the language, just as final source languages always are.
`data` contains the following fields:
* `lang`: The destination language object into which the terms were borrowed, inherited or otherwise derived. Used for
categorization and can be nil, as with {{tl|cog}}.
* `sources`: List of source objects. Most commonly there is only one. If there are multiple, the non-final ones are
handled specially; see above.
* `terms`: List of term objects. Most commonly there is only one. If there are multiple source objects as well as
multiple term objects, the non-final source objects link to the first term object.
* `sort_key`: Sort key for categories. Usually nil.
* `categories`: Categories to add to the page. Additional categories may be added to `categories` based on the source
languages ('''in which case `categories` is destructively modified'''). If `lang` is nil, no categories will be
added.
* `nocat`: Don't add any categories to the page.
* `sourceconj`: Conjunction used to separate multiple source languages. Defaults to {"and"}. Currently recognized
values are `and`, `or`, `,`, `;`, `/` and `~`.
* `borrowing_type`: Borrowing type used in categories, such as {"learned borrowings"}. Defaults to {"terms derived"}.
* `force_cat`: Force category generation on non-mainspace pages.
]==]
function export.format_sources(data)
local lang, sources, terms, borrowing_type, sort_key, categories, nocat =
data.lang, data.sources, data.terms, data.borrowing_type, data.sort_key, data.categories, data.nocat
local term1, sources_n, source_segs = terms[1], #sources, {}
local final_link_page
local term1_term, term1_sc = term1.term, term1.sc
if sources_n > 1 and term1_term and term1_term ~= "-" then
final_link_page = get_link_page(term1_term, sources[sources_n], term1_sc)
end
for i, source in ipairs(sources) do
local seg, display_term
if i < sources_n and term1_term and term1_term ~= "-" then
local link_page = get_link_page(term1_term, source, term1_sc)
display_term = (link_page ~= final_link_page) or (link_page and not not new_title(link_page):getContent())
end
-- TODO: if the display forms or transliterations are different, display the terms separately.
if display_term then
local display, this_cats = export.insert_source_cat_get_display{
lang = lang,
source = source,
borrowing_type = borrowing_type,
raw = true,
categories = categories,
nocat = nocat,
}
seg = language_link {
lang = source,
term = term1_term,
alt = display,
tr = "-",
}
if lang and not nocat then
-- Format categories, but only if there is a current language; {{cog}} currently gets no categories
this_cats = format_categories(this_cats, lang, sort_key, nil, data.force_cat or force_cat)
else
this_cats = ""
end
seg = "<span class=\"etyl\">" .. seg .. this_cats .. "</span>"
else
seg = export.format_source{
lang = lang,
source = source,
borrowing_type = borrowing_type,
sort_key = sort_key,
categories = categories,
nocat = nocat,
}
end
insert(source_segs, seg)
end
return join_segs(source_segs, data.sourceconj or "และ")
end
-- Internal implementation of {{cognate}}/{{cog}} template.
function export.format_cognate(data)
return export.format_derived {
sources = data.sources,
terms = data.terms,
sort_key = data.sort_key,
sourceconj = data.sourceconj,
conj = data.conj,
template_name = "cognate",
force_cat = data.force_cat,
}
end
--[==[
Internal implementation of {{derived}}/{{der}} template. This dispThis is called externally from [[Module:affix]],
[[Module:affixusex]] and [[Module:see]] and needs to support qualifiers, labels and references on the outside
of the sources for use by those modules.
`data` contains the following fields:
* `lang`: The destination language object into which the terms were derived. Used for categorization and can be nil, as
with {{tl|cog}}; in this case, no categories are added.
* `sources`: List of source objects. Most commonly there is only one. If there are multiple, the non-final ones are
handled specially; see `format_sources()`.
* `terms`: List of term objects. Most commonly there is only one. If there are multiple source objects as well as
multiple term objects, the non-final source objects link to the first term object.
* `conj`: Conjunction used to separate multiple terms. '''Required'''. Currently recognized values are `and`, `or`, `,`,
`;`, `/` and `~`.
* `sourceconj`: Conjunction used to separate multiple source languages. Defaults to {"and"}. Currently recognized
values are as for `conj` above.
* `qualifiers_labels_on_outside`: If specified, any qualifiers, labels or references in the first term in `terms` will
be displayed on the outside of (before) the source language(s) in `sources`. Normally this should be specified if
there is only one term possible in `terms`.
* `template_name`: Name of the template invoking this function. Must be specified. Only used for tracking pages.
* `sort_key`: Sort key for categories. Usually nil.
* `categories`: Categories to add to the page. Additional categories may be added to `categories` based on the source
languages ('''in which case `categories` is destructively modified'''). If `lang` is nil, no categories will be
added.
* `nocat`: Don't add any categories to the page.
* `borrowing_type`: Borrowing type used in categories, such as {"learned borrowings"}. Defaults to {"terms derived"}.
* `force_cat`: Force category generation on non-mainspace pages.
]==]
function export.format_derived(data)
local terms = data.terms
local sourcetext = export.format_sources(data)
return export.format_links(terms, data.conj, data.template_name, sourcetext, data.qualifiers_labels_on_outside)
end
function export.insert_borrowed_cat(categories, lang, source)
if lang_is_source(lang, source) then
return
end
-- If both are the same, we want e.g. [[:Category:English terms borrowed back into English]] not
-- [[:Category:English terms borrowed from English]]; the former is inserted automatically by format_source().
-- The second parameter here doesn't matter as it only affects `display`, which we don't use.
--insert(categories, lang:getFullName() .. " terms borrowed from " .. select(2, export.get_display_and_cat_name(source, "raw")))
insert(categories, "ศัพท์ภาษา" .. lang:getFullName() .. "ที่ยืมมาจาก" .. select(2, export.get_display_and_cat_name(source, "raw")))
end
-- Internal implementation of {{borrowed}}/{{bor}} template.
function export.format_borrowed(data)
local categories = {}
if not data.nocat then
local lang = data.lang
for _, source in ipairs(data.sources) do
export.insert_borrowed_cat(categories, lang, source)
end
end
data = shallow_copy(data)
data.categories = categories
return export.format_links(data.terms, data.conj, "borrowed", export.format_sources(data))
end
do
-- Generate the non-ancestor error message.
local function show_language(lang)
local retval = ("%s (%s)"):format(lang:makeCategoryLink(), lang:getCode())
if lang:hasType("etymology-only") then
retval = retval .. (" (an etymology-only language whose regular parent is %s)"):format(
show_language(lang:getParent()))
end
return retval
end
-- Check that `lang` has `otherlang` (which may be an etymology-only language) as an ancestor. Throw an error if
-- not. When `lang` is a family, verifies that `otherlang` is a language in that family.
function export.check_ancestor(lang, otherlang)
-- When `lang` is a family, verify `otherlang` is in that family or in its parent family.
if lang.hasType and lang:hasType("family") then
local family_code = lang:getCode()
local function in_family_code(fcode, other)
if not fcode or fcode == "" then return false end
if other.inFamily and other:inFamily(fcode) then return true end
if other.getFamilyCode and other:getFamilyCode() == fcode then return true end
return false
end
local in_family = in_family_code(family_code, otherlang)
if not in_family then
local parent_code
if lang.getParent then
local parent_family = lang:getParent()
if parent_family and parent_family.getCode then
parent_code = parent_family:getCode()
end
end
if not parent_code and family_code:find("-", 1, true) then
parent_code = family_code:match("^(.+)-[^-]+$")
end
if parent_code then
in_family = in_family_code(parent_code, otherlang)
end
end
if not in_family then
local other_display = (otherlang.getCanonicalName and otherlang:getCanonicalName()) or (otherlang.getCode and otherlang:getCode()) or tostring(otherlang)
local fam_display = (lang.getCanonicalName and lang:getCanonicalName()) or family_code
error(("%s is not in family %s; inherited ancestor under a family must be a language in that family or its parent family.")
:format(other_display, fam_display))
end
return
end
-- FIXME: I don't know if this function works correctly with etym-only languages in `lang`. I have fixed up
-- the module link code appropriately (June 2024) but the remaining logic is untouched.
if lang:hasAncestor(otherlang) then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/etymology/variety]]
-- Track inheritance from varieties of Latin that shouldn't have any descendants (everything except Old Latin, Classical Latin and Vulgar Latin).
if otherlang:getFullCode() == "la" then
otherlang = otherlang:getCode()
if not (otherlang == "itc-ola" or otherlang == "la-cla" or otherlang == "la-vul") then
track("bad ancestor", otherlang)
end
end
return
end
local ancestors, postscript = lang:getAncestors()
local etym_module_link = lang:hasType("etymology-only") and "[[Module:etymology languages/data]] or " or ""
local module_link = "[[" .. get_language_data_module_name(lang:getFullCode()) .. "]]"
if not ancestors[1] then
postscript = show_language(lang) .. " has no ancestors."
else
local ancestor_list = {}
for _, ancestor in ipairs(ancestors) do
insert(ancestor_list, show_language(ancestor))
end
postscript = ("The ancestor%s of %s %s %s."):format(
ancestors[2] and "s" or "", lang:getCanonicalName(),
ancestors[2] and "are" or "is", concat(ancestor_list, " and "))
end
error(("%s is not set as an ancestor of %s in %s%s. %s")
:format(show_language(otherlang), show_language(lang), etym_module_link, module_link, postscript))
end
end
-- Internal implementation of {{inherited}}/{{inh}} template.
function export.format_inherited(data)
local lang, terms, nocat = data.lang, data.terms, data.nocat
local source = terms[1].lang
local categories = {}
if not nocat then
--table.insert(categories, lang:getFullName() .. " terms inherited from " .. source:getCanonicalName())
table.insert(categories, "ศัพท์ภาษา" .. lang:getFullName() .. "ที่สืบทอดจากภาษา" .. source:getCanonicalName())
end
export.check_ancestor(lang, source)
data = shallow_copy(data)
data.categories = categories
data.source = source
return export.format_links(terms, data.conj, "inherited", export.format_source(data))
end
-- Internal implementation of "misc variant" templates such as {{abbrev}}, {{clipping}}, {{reduplication}} and the like.
function export.format_misc_variant(data)
local lang, notext, terms, cats, parts = data.lang, data.notext, data.terms, data.cats, {}
if not notext then
insert(parts, data.text)
end
if terms[1] then
if not notext then
-- FIXME: If term is given as '-', we should consider displaying just "Clipping" not "Clipping of".
insert(parts, data.oftext or "ของ") --th
end
local termparts = {}
-- Make links out of all the parts.
for _, termobj in ipairs(terms) do
local result
if termobj.lang then
result = export.format_derived {
lang = lang,
terms = {termobj},
sources = termobj.termlangs or {termobj.lang},
template_name = "misc_variant",
qualifiers_labels_on_outside = true,
force_cat = data.force_cat,
}
else
termobj.lang = lang
result = export.format_links({termobj}, nil, "misc_variant")
end
table.insert(termparts, result)
end
local linktext = join_segs(termparts, data.conj)
if not notext and linktext ~= "" then
insert(parts, " ")
end
insert(parts, linktext)
end
local categories = {}
if not data.nocat and cats then
for _, cat in ipairs(cats) do
--insert(categories, lang:getFullName() .. " " .. cat)
insert(categories, require("Module:th-utilities").th_categorize(cat, lang:getCategoryName())) --th
end
end
if categories[1] then
insert(parts, format_categories(categories, lang, data.sort_key, nil, data.force_cat or force_cat))
end
return concat(parts)
end
-- Implementation of miscellaneous templates such as {{unknown}} and {{onomatopoeia}} that have no associated terms.
function export.format_misc_variant_no_term(data)
local parts = {}
if not data.notext then
insert(parts, data.title)
end
if not data.nocat and data.cat then
local lang, categories = data.lang, {}
--insert(categories, lang:getFullName() .. " " .. data.cat)
insert(categories, require("Module:th-utilities").th_categorize(data.cat, lang:getCategoryName())) --th
insert(parts, format_categories(categories, lang, data.sort_key, nil, data.force_cat or force_cat))
end
return concat(parts)
end
return export
hwzx4nljgh1ek3bfw0sc6s23cdnw0m9
ตร๊อง
0
170429
5759143
1881946
2026-08-26T08:37:15Z
Ai Ku Karng
17824
/* ภาษาแสก */
5759143
wikitext
text/x-wiki
{{also/auto}}
== ภาษาแสก ==
=== รากศัพท์ ===
{{inh+|skb|tai-pro|*p.taːᴬ}}; ร่วมเชื้อสายกับ{{cog|th|ตา}}, {{cog|lo|ຕາ}}, {{cog|nyw|ตา}}, {{cog|nod|ᨲᩣ}}, {{cog|kkh|ᨲᩣ}}, {{cog|khb|ᦎᦱ}}, {{cog|blt|ꪔꪱ}}, {{cog|shn|တႃ}}, {{cog|tdd|ᥖᥣ}}, {{cog|aio|တႃ}}, {{cog|kht|တႃႈ}}, {{cog|aho|𑜄𑜠}} หรือ {{m|aho|𑜄𑜡}}, {{cog|tyz|tha}}, {{cog|nut|tha}}, {{cog|pcc|dal}}, {{cog|za|da}}, {{cog|zzj|ta/ha}}; เทียบในกลุ่มภาษาขร้า-ไท {{cog|swi|ndal}}, {{cog|kmc|dal}}, {{cog|lic|-}} [ʈʂʰaː¹] และ {{cog|onb|-}} [ɗa¹]; เทียบ{{cog|och|-}} {{och-l|睹|เห็น}}, {{cog|map-pro|*mata||ตา}}
=== การออกเสียง ===
* {{IPA|skb|/trɔːŋ⁴/|[trɔːŋ˦˥˦]|a=บ้านบะหว้า}}
=== คำนาม ===
{{skb-noun}}
# [[ตา]] (อวัยวะ)
beshf22sc3ntt71zb43dhkw22cn7kxd
ศฐะ
0
234115
5759146
1643874
2026-08-26T09:44:37Z
Jamnanja
16523
/* รากศัพท์ */
5759146
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{bor+|th|sa|शठ}}; เทียบ{{cog|pi|สฐ}} (ซึ่งยืมมาเป็น{{cog|th|สฐะ}})
=== การออกเสียง ===
{{th-pron|สะ-ถะ}}
=== คำนาม ===
{{th-noun}}
# {{lb|th|กลอน}} [[คน]][[โกง]], คน[[ล่อลวง]]
# {{lb|th|กลอน}} คน[[โอ้อวด]]
m18vda17zabas7wonur1w18e8n26hgm
generation
0
257021
5759151
2000978
2026-08-26T11:53:24Z
Alifshinobi
397
/* คำนาม */
5759151
wikitext
text/x-wiki
{{also/auto}}
== ภาษาอังกฤษ ==
{{lexitronimport}}
=== การออกเสียง{{botenimport}} ===
* {{IPA|en|/ˌd͡ʒɛnəˈɹeɪʃən/|a=GA,RP}}
* {{audio|en|en-us-generation.ogg|a=US}}
* {{rhymes|eɪʃən|lang=en}}
* {{hyphenation|en|gen|er|a|tion}}
=== คำนาม ===
{{en-noun|~}}{{botenimport}}
# การแพร่พันธุ์
# ยุค
# คนรุ่นราวคราวเดียวกัน, [[ชั่วรุ่น]], [[รุ่น]]
2nt22x8mk3ojxu2b7mzph3u1w0wvlsh
twin
0
257770
5759120
2001674
2026-08-25T19:08:51Z
Alifshinobi
397
/* คำนาม */
5759120
wikitext
text/x-wiki
== ภาษาอังกฤษ ==
{{lexitronimport}}
=== การออกเสียง{{botenimport}} ===
* {{IPA|en|/twɪn/}}
* {{audio|en|En-us-twin.ogg|a=US}}
* {{rhymes|ɪn|lang=en}}
=== คำนาม ===
{{en-noun}}{{botenimport}}
# [[แฝด]], [[ฝาแฝด]]
# ความเหมือนกัน
=== คำกริยา ===
{{en-verb}}{{botenimport}}
# {{lb|en|อกรรม}} เป็นคู่กัน
# {{lb|en|อกรรม}} มีฝาแฝด
# {{lb|en|สกรรม}} ทำให้เป็นคู่กัน
d1lreo4sr3jcr0rt7exys0rxh4y7jdz
ร้าง
0
293997
5759142
1883542
2026-08-26T08:11:58Z
Jamnanja
16523
/* คำคุณศัพท์ */
5759142
wikitext
text/x-wiki
{{also/auto}}
== ภาษาไทย ==
=== รากศัพท์ ===
ร่วมเชื้อสายกับ{{cog|tts|ฮ้าง}} หรือ {{m|tts|ฮ่าง}}, {{cog|lo|ຮ້າງ}}, {{cog|nod|ᩁ᩶ᩣ᩠ᨦ}}, {{cog|kkh|ᩁ᩶ᩣ᩠ᨦ}}, {{cog|khb|ᦣᦱᧂᧉ}}, {{cog|blt|ꪭ꫁ꪱꪉ}}, {{cog|shn|ႁၢင်ႉ}}, {{cog|aho|𑜑𑜂𑜫}}
=== การออกเสียง ===
{{th-pron}}
=== คำกริยา ===
{{th-verb}}
# [[จาก]][[ไป]][[ชั่วคราว]]
#: {{ux|th|นิราศร้างห่างเหเสน่หา}}
# [[แยก]][[กัน]][[อยู่]][[แต่]][[ยัง]][[ไม่]][[หย่า]][[ขาด]][[จาก]]กัน
#: {{ux|th|ผัวเมียร้างกัน}}
=== คำคุณศัพท์ ===
{{th-adj}}
# [[ที่]][[ถูก]][[ทอดทิ้ง]]
#: {{ux|th|พ่อร้าง}}
#: {{ux|th|แม่ร้าง}}
# [[ว่างเปล่า]], [[ปราศจาก]][[ผู้คน]]
#: {{ux|th|บ้านร้าง}}
#: {{ux|th|เมืองร้าง}}
==== คำพ้องความ ====
* [[วิชน]]
c6rhye138vo4wh73mra6hfuow0gzx5j
ꪜ꫁ꪱ
0
297277
5759129
1501284
2026-08-26T04:20:31Z
Thai-Northeastern
17169
/* การออกเสียง */
5759129
wikitext
text/x-wiki
== ภาษาไทดำ ==
=== การออกเสียง ===
{{blt-pron}}* {{คำอ่านไทย|ป่า}}
=== คำนาม ===
{{blt-noun}}
# [[ป้า]]
42l3opfqoukq7looejey88kzg1hg6d8
5759130
5759129
2026-08-26T04:20:58Z
Thai-Northeastern
17169
/* การออกเสียง */
5759130
wikitext
text/x-wiki
== ภาษาไทดำ ==
=== การออกเสียง ===
{{blt-pron}}*
{{คำอ่านไทย|ป่า}}
=== คำนาม ===
{{blt-noun}}
# [[ป้า]]
3puhkeo8n0vrcgjc05gvkrnblg7322n
5759131
5759130
2026-08-26T04:21:15Z
Thai-Northeastern
17169
/* การออกเสียง */
5759131
wikitext
text/x-wiki
== ภาษาไทดำ ==
=== การออกเสียง ===
{{blt-pron}}*
* {{คำอ่านไทย|ป่า}}
=== คำนาม ===
{{blt-noun}}
# [[ป้า]]
sdote08mxe62zu763e2xqggeu4b8i6e
ᨶᩱ
0
298598
5759123
3325510
2026-08-26T01:50:13Z
Ai Ku Karng
17824
/* ภาษาคำเมือง */
5759123
wikitext
text/x-wiki
{{also/auto}}
== ภาษาคำเมือง ==
=== รูปแบบอื่น ===
{{nod-alt|~=ไน}}
* {{alt|nod|*ᨶᩲ||เลิกใช้}}
=== รากศัพท์ ===
{{inh+|nod|tai-pro|*C̥.daɰᴬ}}, ซึ่ง /aɰ/ กลายเป็น /aj/, จาก{{der|nod|ltc|-}} {{ltc-l|內}}; ร่วมเชื้อสายกับ{{cog|th|ใน}}, {{cog|lo|ໃນ}}, {{cog|kkh|ᨶᩱ}}, {{cog|khb|ᦺᦓ}}, {{cog|shn|ၼႂ်း}}, {{cog|tdd|ᥘᥬᥰ}}, {{cog|blt|ꪻꪙ}}, {{cog|aho|𑜃𑜧}}, {{cog|za|ndaw}}
=== การออกเสียง ===
* {{IPA|nod|/naj˧˧/|a=เชียงใหม่}}
=== คำบุพบท ===
{{nod-prep}}
# [[ใน]]
#: {{ant|nod|ᨶᩬᨠ}}
dulcb3gercw8wxa0vn8bun6lb6q6iy0
แม่แบบ:reduplication
10
332639
5759134
1768958
2026-08-26T04:31:50Z
Octahedron80
267
นำเข้าจาก enwikt
5759134
wikitext
text/x-wiki
{{#invoke:etymology/templates|misc_variant|text=[[ภาคผนวก:อภิธานศัพท์#ซ้ำ|คำซ้ำ]]|cat=คำซ้ำ|conj=หรือ}}<noinclude>{{documentation}}</noinclude>
qt3yfvlyccf44ilr6m11qtueies81o4
พันธุ
0
334071
5759149
5033930
2026-08-26T11:50:07Z
Alifshinobi
397
/* ลูกคำ */
5759149
wikitext
text/x-wiki
{{also/auto}}
== ภาษาไทย ==
=== รากศัพท์ ===
{{bor+|th|sa|बन्धु}} หรือ{{bor|th|pi|พนฺธุ}}
=== การออกเสียง ===
{{th-pron|พัน-ทุ-}}
=== คำนาม ===
{{th-noun}}
# {{alternative form of|th|พันธุ์}}
==== ลูกคำ ====
{{col4|th|พันธุกรรม|พันธุกรรมนิยม|พันธุศาสตร์|พันธุวิศวกรรม|พันธุฆาต|พันธุนิเวศวิทยา|พันธุประวัติ|พันธุลักษณ์|สุพันธุศาสตร์}}
1fdcr0zobt5nj8oov1bqpsgcmd00q9s
มอดูล:romance etymology
828
337751
5759136
1906760
2026-08-26T04:59:14Z
Octahedron80
267
5759136
Scribunto
text/plain
local export = {}
local m_links = require("Module:links")
local affix_module = "Module:affix"
local parameter_utilities_module = "Module:parameter utilities"
local force_cat = false -- set to true for testing
local function verb_obj_or_verb_verb(data, frame, obj_or_verb)
local parent_args = frame:getParent().args
local object_or_verb = obj_or_verb == "กรรม" and "กรรม" or "กริยา"
local params = {
[1] = {list = true, required = true, disallow_holes = true},
["sort"] = {},
["nocat"] = {type = "boolean"},
["nocap"] = {type = "boolean"},
["notext"] = {type = "boolean"},
}
local m_param_utils = require(parameter_utilities_module)
local param_mods = m_param_utils.construct_param_mods {
{default = true, require_index = true},
{group = "link", exclude = {"tr", "ts", "sc"}},
{group = {"q", "l", "ref"}},
-- Override to have separate_no_index set so we have an overall lit=.
{param = "lit", separate_no_index = true},
{param = {"pl", "imp"}},
{param = "type", set = {"กริยา", "กรรม", "ตัวเชื่อมต่อ"}},
}
local items, args = m_param_utils.parse_list_with_inline_modifiers_and_separate_params {
params = params,
param_mods = param_mods,
raw_args = parent_args,
process_args_before_parsing = function(args)
if #args[1] < 2 then
local NAMESPACE = mw.title.getCurrentTitle().nsText
if NAMESPACE == "แม่แบบ" then
for _, defarg in ipairs(data.default_args) do
table.insert(args[1], defarg)
end
else
error(("Need at least two numbered arguments to [[Template:%s-%s]]"):format(
data.lang:getCode(), template_name))
end
end
end,
termarg = 1,
track_module = "romance-etymology",
parse_lang_prefix = true,
-- Don't include `lang` because the code below expects it to be set only when explicitly given
}
for i, item in ipairs(items) do
if not item.term:find("%[") then
local parttype = item.type
if not parttype then
if i == 1 then
parttype = "กริยา"
elseif i == #items then
parttype = object_or_verb
else
if data.looks_like_infinitive(item.term) then
parttype = "กริยา"
else
parttype = "ตัวเชื่อมต่อ"
end
end
end
if parttype ~= "กรรม" and item.pl then
parse_err(("Can't specify <pl:...> with an argument that is not an object (argument type is '%s')"):
format(parttype))
end
if parttype ~= "กริยา" and item.imp then
parse_err(("Can't specify <imp:...> with an argument that is not a verb (argument type is '%s')"):
format(parttype))
end
if parttype == "กริยา" then
local imp
item.imp = item.imp or "+"
if item.imp:find("^%+") then
if item.lang then
parse_err(("Can't form default imperative given with explicit language code prefix '%s'"):
format(item.lang:getCode()))
end
imp = data.make_imperative(item.imp, item.term, parse_err)
if not imp then
parse_err("Default imperative algorithm was unable to form the imperative")
end
elseif item.imp then
imp = item.imp
end
if imp then
item.term = ("[[%s|%s]]"):format(item.term, imp)
end
elseif parttype == "กรรม" then
local pl
if item.pl == "1" or item.pl and item.pl:find("^%+") then
if item.lang then
parse_err(("Can't form default plural of term '%s' given with explicit language code prefix '%s'"):
format(item.term, item.lang:getCode()))
end
pl = data.make_plural(item.pl, item.term, parse_err)
if not pl then
parse_err(("Default plural algorithm was unable to form the plural of term '%s'"):format(item.term))
end
elseif item.pl then
pl = item.pl
end
if pl then
item.term = ("[[%s|%s]]"):format(item.term, pl)
end
end
end
item.lang = item.lang or data.lang
items[i] = m_links.full_link(item, "term", "allow self link", "show qualifiers")
end
local result = {}
local function ins(text)
table.insert(result, text)
end
if not args.notext then
--if args.nocap then
-- ins("verb-" .. object_or_verb)
--else
-- ins("Verb-" .. object_or_verb)
--end
ins("คำประสมกริยา-" .. object_or_verb .. "ของ ")
end
ins(require(affix_module).join_formatted_parts {
data = {
lang = data.lang,
nocat = args.nocat,
sort_key = args.sort,
lit = args.lit.default,
force_cat = force_cat,
q = args.q.default,
qq = args.qq.default,
l = args.l.default,
ll = args.ll.default,
},
parts_formatted = items,
categories = {("คำประสมกริยา-%s"):format(object_or_verb)},
})
return table.concat(result)
end
function export.verb_obj(data, frame)
return verb_obj_or_verb_verb(data, frame, "กรรม")
end
function export.verb_verb(data, frame)
return verb_obj_or_verb_verb(data, frame, "กริยา")
end
return export
382xbeiytm8q6g2w5pykyw84nghp1ji
คุยกับผู้ใช้:ມາຍ
3
2358136
5759119
2026-08-25T14:26:55Z
New user message
2698
เพิ่ม[[Template:Welcome|สารต้อนรับ]]ในหน้าคุยของผู้ใช้ใหม่
5759119
wikitext
text/x-wiki
{{Template:Welcome|realName=|name=ມາຍ}}
-- [[ผู้ใช้:New user message|New user message]] ([[คุยกับผู้ใช้:New user message|คุย]]) 21:26, 25 สิงหาคม 2569 (+07)
ibsipolt8sk0r3vv4u0xo4mp02t3zpy
นิ้วเบียด
0
2358137
5759126
2026-08-26T02:57:35Z
Octahedron80
267
เก็บกวาด
5759126
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{com|th|นิ้ว|เบียด}}
=== การออกเสียง ===
{{th-pron|นิ้ว-เบียด}}
=== คำนาม ===
{{th-noun}}
# {{lb|th|ปาก|สแลง}} [[อาการ]][[ที่]][[พิมพ์]][[ข้อความ]][[บน]][[โทรศัพท์มือถือ]][[หรือ]][[คอมพิวเตอร์]][[ผิดพลาด]] [[เนื่องจาก]][[นิ้ว]][[ไป]][[โดน]][[ปุ่ม]][[ตัวอักษร]][[ข้างเคียง]] [[แทน]]ที่[[จะ]][[เป็น]]ตัวอักษรที่[[ตั้งใจ]]จะ[[กด]] [[ซึ่ง]][[บางครั้ง]][[ทำ]][[ให้]][[ความหมาย]]ที่จะ[[สื่อ]][[ผิด]]ไป
ahutvvfl8i5qmn1yk31bls8if6henj3
5759127
5759126
2026-08-26T02:58:12Z
Octahedron80
267
/* คำนาม */
5759127
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{com|th|นิ้ว|เบียด}}
=== การออกเสียง ===
{{th-pron|นิ้ว-เบียด}}
=== คำนาม ===
{{th-noun}}
# {{lb|th|ปาก|สแลง}} [[อาการ]][[ที่]][[พิมพ์]][[ข้อความ]][[บน]][[โทรศัพท์มือถือ]][[หรือ]][[คอมพิวเตอร์]][[ผิดพลาด]] [[เนื่องจาก]][[นิ้ว]][[ไป]][[โดน]][[ปุ่ม]][[ตัวอักษร]][[ข้างเคียง]] [[แทน]]ที่[[จะ]][[เป็น]]ตัวอักษรที่[[ตั้งใจ]]จะ[[กด]] [[ซึ่ง]][[บาง]][[ครั้ง]][[ทำ]][[ให้]][[ความหมาย]]ที่จะ[[สื่อ]][[ผิด]]ไป
e4kbaowootnon0gb1jf8y3taiatk47q
5759128
5759127
2026-08-26T03:01:11Z
Octahedron80
267
/* รากศัพท์ */
5759128
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{com|th|นิ้ว|เบียด}}; เทียบ{{ncog|en|fat finger}} ที่ความหมายคล้ายกัน
=== การออกเสียง ===
{{th-pron|นิ้ว-เบียด}}
=== คำนาม ===
{{th-noun}}
# {{lb|th|ปาก|สแลง}} [[อาการ]][[ที่]][[พิมพ์]][[ข้อความ]][[บน]][[โทรศัพท์มือถือ]][[หรือ]][[คอมพิวเตอร์]][[ผิดพลาด]] [[เนื่องจาก]][[นิ้ว]][[ไป]][[โดน]][[ปุ่ม]][[ตัวอักษร]][[ข้างเคียง]] [[แทน]]ที่[[จะ]][[เป็น]]ตัวอักษรที่[[ตั้งใจ]]จะ[[กด]] [[ซึ่ง]][[บาง]][[ครั้ง]][[ทำ]][[ให้]][[ความหมาย]]ที่จะ[[สื่อ]][[ผิด]]ไป
5z5bjmoxlt0xq8g8um0hjpxkrlze5g6
เยเย่
0
2358138
5759133
2026-08-26T04:27:39Z
Octahedron80
267
สร้างหน้าด้วย "== ภาษาไทย == === รากศัพท์ === {{reduplication|th|เย}}, แผลงมาจาก {{m|th|เย็ด}} === การออกเสียง === {{th-pron|เย-เย่}} === คำกริยา === {{th-verb}} # {{lb|th|ปาก|สแลง}} [[ร่วมประเวณี]] {{topics|th|เพศ}}"
5759133
wikitext
text/x-wiki
== ภาษาไทย ==
=== รากศัพท์ ===
{{reduplication|th|เย}}, แผลงมาจาก {{m|th|เย็ด}}
=== การออกเสียง ===
{{th-pron|เย-เย่}}
=== คำกริยา ===
{{th-verb}}
# {{lb|th|ปาก|สแลง}} [[ร่วมประเวณี]]
{{topics|th|เพศ}}
bm6vvao9uaa3n8ubuziqtb332rawo5c
ނަން
0
2358139
5759148
2026-08-26T10:35:37Z
Jamnanja
16523
/* */
5759148
wikitext
text/x-wiki
== ภาษามัลดีฟส์ ==
=== คำนาม ===
{{dv-noun}}
# [[ชื่อ]]
# {{lb|dv|ไวยากรณ์}} [[คำนาม]]
h908j5ayu963a7azi348f80csde4gfv