উইকিঅভিধান
bnwiktionary
https://bn.wiktionary.org/wiki/%E0%A6%AA%E0%A7%8D%E0%A6%B0%E0%A6%A7%E0%A6%BE%E0%A6%A8_%E0%A6%AA%E0%A6%BE%E0%A6%A4%E0%A6%BE
MediaWiki 1.47.0-wmf.5
case-sensitive
মিডিয়া
বিশেষ
আলাপ
ব্যবহারকারী
ব্যবহারকারী আলাপ
উইকিঅভিধান
উইকিঅভিধান আলোচনা
চিত্র
চিত্র আলোচনা
মিডিয়াউইকি
মিডিয়াউইকি আলোচনা
টেমপ্লেট
টেমপ্লেট আলোচনা
সাহায্য
সাহায্য আলোচনা
বিষয়শ্রেণী
বিষয়শ্রেণী আলোচনা
পরিশিষ্ট
পরিশিষ্ট আলোচনা
ছন্দ
ছন্দ আলোচনা
থিসরাস
থিসরাস আলোচনা
উদ্ধৃতি
উদ্ধৃতি আলোচনা
TimedText
TimedText talk
মডিউল
মডিউল আলাপ
ইভেন্ট
ইভেন্ট আলোচনা
মডিউল:headword
828
6292
509625
325392
2026-06-03T08:25:29Z
Redmin
6857
509625
Scribunto
text/plain
local export = {}
-- Named constants for all modules used, to make it easier to swap out sandbox versions.
local debug_track_module = "Module:debug/track"
local en_utilities_module = "Module:en-utilities"
local gender_and_number_module = "Module:gender and number"
local headword_data_module = "Module:headword/data"
local headword_page_module = "Module:headword/page"
local links_module = "Module:links"
local load_module = "Module:load"
local pages_module = "Module:pages"
local palindromes_module = "Module:palindromes"
local pron_qualifier_module = "Module:pron qualifier"
local scripts_module = "Module:scripts"
local scripts_data_module = "Module:scripts/data"
local script_utilities_module = "Module:script utilities"
local script_utilities_data_module = "Module:script utilities/data"
local string_utilities_module = "Module:string utilities"
local table_module = "Module:table"
local utilities_module = "Module:utilities"
local concat = table.concat
local insert = table.insert
local ipairs = ipairs
local max = math.max
local new_title = mw.title.new
local pairs = pairs
local require = require
local toNFC = mw.ustring.toNFC
local toNFD = mw.ustring.toNFD
local type = type
local ufind = mw.ustring.find
local ugmatch = mw.ustring.gmatch
local ugsub = mw.ustring.gsub
local umatch = mw.ustring.match
--[==[
Loaders for functions in other modules, which overwrite themselves with the target function when called. This ensures modules are only loaded when needed, retains the speed/convenience of locally-declared pre-loaded functions, and has no overhead after the first call, since the target functions are called directly in any subsequent calls.]==]
local function debug_track(...)
debug_track = require(debug_track_module)
return debug_track(...)
end
local function encode_entities(...)
encode_entities = require(string_utilities_module).encode_entities
return encode_entities(...)
end
local function extend(...)
extend = require(table_module).extend
return extend(...)
end
local function find_best_script_without_lang(...)
find_best_script_without_lang = require(scripts_module).findBestScriptWithoutLang
return find_best_script_without_lang(...)
end
local function format_categories(...)
format_categories = require(utilities_module).format_categories
return format_categories(...)
end
local function format_genders(...)
format_genders = require(gender_and_number_module).format_genders
return format_genders(...)
end
local function format_pron_qualifiers(...)
format_pron_qualifiers = require(pron_qualifier_module).format_qualifiers
return format_pron_qualifiers(...)
end
local function full_link(...)
full_link = require(links_module).full_link
return full_link(...)
end
local function get_current_L2(...)
get_current_L2 = require(pages_module).get_current_L2
return get_current_L2(...)
end
local function get_link_page(...)
get_link_page = require(links_module).get_link_page
return get_link_page(...)
end
local function get_script(...)
get_script = require(scripts_module).getByCode
return get_script(...)
end
local function is_palindrome(...)
is_palindrome = require(palindromes_module).is_palindrome
return is_palindrome(...)
end
local function language_link(...)
language_link = require(links_module).language_link
return language_link(...)
end
local function load_data(...)
load_data = require(load_module).load_data
return load_data(...)
end
local function pattern_escape(...)
pattern_escape = require(string_utilities_module).pattern_escape
return pattern_escape(...)
end
local function pluralize(...)
pluralize = require(en_utilities_module).pluralize
return pluralize(...)
end
local function process_page(...)
process_page = require(headword_page_module).process_page
return process_page(...)
end
local function remove_links(...)
remove_links = require(links_module).remove_links
return remove_links(...)
end
local function shallow_copy(...)
shallow_copy = require(table_module).shallowCopy
return shallow_copy(...)
end
local function tag_text(...)
tag_text = require(script_utilities_module).tag_text
return tag_text(...)
end
local function tag_transcription(...)
tag_transcription = require(script_utilities_module).tag_transcription
return tag_transcription(...)
end
local function tag_translit(...)
tag_translit = require(script_utilities_module).tag_translit
return tag_translit(...)
end
local function trim(...)
trim = require(string_utilities_module).trim
return trim(...)
end
local function ulen(...)
ulen = require(string_utilities_module).len
return ulen(...)
end
--[==[
Loaders for objects, which load data (or some other object) into some variable, which can then be accessed as "foo or get_foo()", where the function get_foo sets the object to "foo" and then returns it. This ensures they are only loaded when needed, and avoids the need to check for the existence of the object each time, since once "foo" has been set, "get_foo" will not be called again.]==]
local m_data
local function get_data()
m_data = load_data(headword_data_module)
return m_data
end
local script_data
local function get_script_data()
script_data = load_data(scripts_data_module)
return script_data
end
local script_utilities_data
local function get_script_utilities_data()
script_utilities_data = load_data(script_utilities_data_module)
return script_utilities_data
end
-- If set to true, categories always appear, even in non-mainspace pages
local test_force_categories = false
-- Add a tracking category to track entries with certain (unusually undesirable) properties. `track_id` is an identifier
-- for the particular property being tracked and goes into the tracking page. Specifically, this adds a link in the
-- page text to [[Wiktionary:Tracking/headword/TRACK_ID]], meaning you can find all entries with the `track_id` property
-- by visiting [[Special:WhatLinksHere/Wiktionary:Tracking/headword/TRACK_ID]].
--
-- If `lang` (a language object) is given, an additional tracking page [[Wiktionary:Tracking/headword/TRACK_ID/CODE]] is
-- linked to where CODE is the language code of `lang`, and you can find all entries in the combination of `track_id`
-- and `lang` by visiting [[Special:WhatLinksHere/Wiktionary:Tracking/headword/TRACK_ID/CODE]]. This makes it possible to
-- isolate only the entries with a specific tracking property that are in a given language. Note that if `lang`
-- references at etymology-only language, both that language's code and its full parent's code are tracked.
local function track(track_id, lang)
local tracking_page = "headword/" .. track_id
if lang and lang:hasType("etymology-only") then
debug_track{tracking_page, tracking_page .. "/" .. lang:getCode(),
tracking_page .. "/" .. lang:getFullCode()}
elseif lang then
debug_track{tracking_page, tracking_page .. "/" .. lang:getCode()}
else
debug_track(tracking_page)
end
return true
end
local function text_in_script(text, script_code)
local sc = get_script(script_code)
if not sc then
error("অভ্যন্তরীন ত্রুটি: বাজে ভাষা কোড " .. script_code)
end
local characters = sc.characters
local out
if characters then
text = ugsub(text, "%W", "")
out = ufind(text, "[" .. characters .. "]")
end
if out then
return true
else
return false
end
end
local spacingPunctuation = "[%s%p]+"
--[[ List of punctuation or spacing characters that are found inside of words.
Used to exclude characters from the regex above. ]]
local wordPunc = "-#%%&@־׳״'.·*’་•:᠊"
local notWordPunc = "[^" .. wordPunc .. "]+"
-- Format a term (either a head term or an inflection term) along with any left or right qualifiers, labels, references
-- or customized separator: `part` is the object specifying the term (and `lang` the language of the term), which should
-- optionally contain:
-- * left qualifiers in `q`, an array of strings;
-- * right qualifiers in `qq`, an array of strings;
-- * left labels in `l`, an array of strings;
-- * right labels in `ll`, an array of strings;
-- * references in `refs`, an array either of strings (formatted reference text) or objects containing fields `text`
-- (formatted reference text) and optionally `name` and/or `group`;
-- * a separator in `separator`, defaulting to " <i>or</i> " if this is not the first term (j > 1), otherwise "".
-- `formatted` is the formatted version of the term itself, and `j` is the index of the term.
local function format_term_with_qualifiers_and_refs(lang, part, formatted, j)
local function part_non_empty(field)
local list = part[field]
if not list then
return nil
end
if type(list) ~= "table" then
error(("Internal error: Wrong type for `part.%s`=%s, should be \"table\""):format(field, mw.dumpObject(list)))
end
return list[1]
end
if part_non_empty("q") or part_non_empty("qq") or part_non_empty("l") or
part_non_empty("ll") or part_non_empty("refs") then
formatted = format_pron_qualifiers {
lang = lang,
text = formatted,
q = part.q,
qq = part.qq,
l = part.l,
ll = part.ll,
refs = part.refs,
}
end
local separator = part.separator or j > 1 and " <i>or</i> " -- use "" to request no separator
if separator then
formatted = separator .. formatted
end
return formatted
end
--[==[Return true if the given head is multiword according to the algorithm used in full_headword().]==]
function export.head_is_multiword(head)
for possibleWordBreak in ugmatch(head, spacingPunctuation) do
if umatch(possibleWordBreak, notWordPunc) then
return true
end
end
return false
end
do
local function workaround_to_exclude_chars(s)
return (ugsub(s, notWordPunc, "\2%1\1"))
end
--[==[Add links to a multiword head.]==]
function export.add_multiword_links(head, default)
head = "\1" .. ugsub(head, spacingPunctuation, workaround_to_exclude_chars) .. "\2"
if default then
head = head
:gsub("(\1[^\2]*)\\([:#][^\2]*\2)", "%1\\\\%2")
:gsub("(\1[^\2]*)([:#][^\2]*\2)", "%1\\%2")
end
--Escape any remaining square brackets to stop them breaking links (e.g. "[citation needed]").
head = encode_entities(head, "[]", true, true)
--[=[
use this when workaround is no longer needed:
head = "[[" .. ugsub(head, WORDBREAKCHARS, "]]%1[[") .. "]]"
Remove any empty links, which could have been created above
at the beginning or end of the string.
]=]
return (head
:gsub("\1\2", "")
:gsub("[\1\2]", {["\1"] = "[[", ["\2"] = "]]"}))
end
end
local function non_categorizable(full_raw_pagename)
return full_raw_pagename:find("^Appendix:Gestures/") or
-- Unsupported titles with descriptive names.
(full_raw_pagename:find("^Unsupported titles/") and not full_raw_pagename:find("`"))
end
local function tag_text_and_add_quals_and_refs(data, head, formatted, j)
-- Add language and script wrapper.
formatted = tag_text(formatted, data.lang, head.sc, "head", nil, j == 1 and data.id or nil)
-- Add qualifiers, labels, references and separator.
return format_term_with_qualifiers_and_refs(data.lang, head, formatted, j)
end
-- Format a headword with transliterations.
local function format_headword(data)
-- Are there non-empty transliterations?
local has_translits = false
local has_manual_translits = false
------ Format the headwords. ------
local head_parts = {}
local unique_head_parts = {}
local has_multiple_heads = not not data.heads[2]
for j, head in ipairs(data.heads) do
if head.tr or head.ts then
has_translits = true
end
if head.tr and head.tr_manual or head.ts then
has_manual_translits = true
end
local formatted
-- Apply processing to the headword, for formatting links and such.
if head.term:find("[[", nil, true) and head.sc:getCode() ~= "Image" then
formatted = language_link{term = head.term, lang = data.lang}
else
formatted = data.lang:makeDisplayText(head.term, head.sc, true)
end
local head_part = tag_text_and_add_quals_and_refs(data, head, formatted, j)
insert(head_parts, head_part)
-- If multiple heads, try to determine whether all heads display the same. To do this we need to effectively
-- rerun the text tagging and addition of qualifiers and references, using 1 for all indices.
if has_multiple_heads then
local unique_head_part
if j == 1 then
unique_head_part = head_part
else
unique_head_part = tag_text_and_add_quals_and_refs(data, head, formatted, 1)
end
unique_head_parts[unique_head_part] = true
end
end
local set_size = 0
if has_multiple_heads then
for _ in pairs(unique_head_parts) do
set_size = set_size + 1
end
end
if set_size == 1 then
head_parts = head_parts[1]
else
head_parts = concat(head_parts)
end
if has_manual_translits then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/manual-tr]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/manual-tr/LANGCODE]]
track("manual-tr", data.lang)
end
------ Format the transliterations and transcriptions. ------
local translits_formatted
if has_translits then
local translit_parts = {}
for _, head in ipairs(data.heads) do
if head.tr or head.ts then
local this_parts = {}
if head.tr then
insert(this_parts, tag_translit(head.tr, data.lang:getCode(), "head", nil, head.tr_manual))
if head.ts then
insert(this_parts, " ")
end
end
if head.ts then
insert(this_parts, "/" .. tag_transcription(head.ts, data.lang:getCode(), "head") .. "/")
end
insert(translit_parts, concat(this_parts))
end
end
translits_formatted = " (" .. concat(translit_parts, " <i>or</i> ") .. ")"
local langname = data.lang:getCanonicalName()
local transliteration_page = new_title(langname .. " প্রতিবর্ণীকরণ", "উইকিঅভিধান")
local saw_translit_page = false
if transliteration_page and transliteration_page.exists then
translits_formatted = " [[উইকিঅভিধান:" .. langname .. " প্রতিবর্ণীকরণ|•]]" .. translits_formatted
saw_translit_page = true
end
-- If data.lang is an etymology-only language and we didn't find a translation page for it, fall back to the
-- full parent.
if not saw_translit_page and data.lang:hasType("etymology-only") then
langname = data.lang:getFullName()
transliteration_page = new_title(langname .. " প্রতিবর্ণীকরণ", "উইকিঅভিধান")
if transliteration_page and transliteration_page.exists then
translits_formatted = " [[উইকিঅভিধান:" .. langname .. " প্রতিবর্ণীকরণ|•]]" .. translits_formatted
end
end
else
translits_formatted = ""
end
------ Paste heads and transliterations/transcriptions. ------
local lemma_gloss
if data.gloss then
lemma_gloss = ' <span class="ib-content qualifier-content">' .. data.gloss .. '</span>'
else
lemma_gloss = ""
end
return head_parts .. translits_formatted .. lemma_gloss
end
local function format_headword_genders(data)
local retval = ""
if data.genders and data.genders[1] then
if data.gloss then
retval = ","
end
local pos_for_cat
if not data.nogendercat then
local no_gender_cat = (m_data or get_data()).no_gender_cat
if not (no_gender_cat[data.lang:getCode()] or no_gender_cat[data.lang:getFullCode()]) then
pos_for_cat = (m_data or get_data()).pos_for_gender_number_cat[data.pos_category:gsub("^reconstructed ", "")]
end
end
local text, cats = format_genders(data.genders, data.lang, pos_for_cat)
if cats then
extend(data.categories, cats)
end
retval = retval .. " " .. text
end
return retval
end
local function format_inflection_parts(data, parts)
local any_part_translit = false
for j, part in ipairs(parts) do
if type(part) ~= "table" then
part = {term = part}
end
local partaccel = part.accel
local face = part.face or "bold"
if face ~= "bold" and face ~= "plain" and face ~= "hypothetical" then
error("The face `" .. face .. "` " .. (
(script_utilities_data or get_script_utilities_data()).faces[face] and
"should not be used for non-headword terms on the headword line." or
"is invalid."
))
end
-- Here the final part 'or data.nolinkinfl' allows to have 'nolinkinfl=true'
-- right into the 'data' table to disable inflection links of the entire headword
-- when inflected forms aren't entry-worthy, e.g.: in Vulgar Latin
local nolinkinfl = part.face == "hypothetical" or (part.nolink and track("nolink") or part.nolinkinfl) or (
data.nolink and track("nolink") or data.nolinkinfl)
local formatted
if part.label then
-- FIXME: There should be a better way of italicizing a label. As is, this isn't customizable.
formatted = "<i>" .. part.label .. "</i>"
else
-- Convert the term into a full link. Don't show a transliteration here unless enable_auto_translit is
-- requested, either at the `parts` level (i.e. per inflection) or at the `data.inflections` level (i.e.
-- specified for all inflections). This is controllable in {{head}} using autotrinfl=1 for all inflections,
-- or fNautotr=1 for an individual inflection (remember that a single inflection may be associated with
-- multiple terms). The reason for doing this is to avoid clutter in headword lines by default in languages
-- where the script is relatively straightforward to read by learners (e.g. Greek, Russian), but allow it
-- to be enabled in languages with more complex scripts (e.g. Arabic).
local tr = part.translit or (not (parts.enable_auto_translit or data.inflections.enable_auto_translit) and "-" or nil)
if tr ~= "-" then
any_part_translit = true
end
formatted = full_link(
{
term = not nolinkinfl and part.term or nil,
alt = part.alt or (nolinkinfl and part.term or nil),
lang = part.lang or data.lang,
sc = part.sc or parts.sc or nil,
gloss = part.gloss,
pos = part.pos,
lit = part.lit,
id = part.id,
genders = part.genders,
tr = tr,
ts = part.transcription,
accel = partaccel or parts.accel,
},
face
)
end
parts[j] = format_term_with_qualifiers_and_refs(part.lang or data.lang, part,
formatted, j)
end
local parts_output
if parts[1] then
parts_output = (parts.label and " " or "") .. concat(parts)
elseif parts.request then
parts_output = " <small>[please provide]</small>"
insert(data.categories, "Requests for inflections in " .. data.lang:getFullName() .. " entries")
else
parts_output = ""
end
local parts_label = parts.label and ("<i>" .. parts.label .. "</i>") or ""
return format_term_with_qualifiers_and_refs(data.lang, parts, parts_label .. parts_output, 1), any_part_translit
end
-- Format the inflections following the headword.
local function format_inflections(data)
local any_part_translit = false
if data.inflections and data.inflections[1] then
-- Format each inflection individually.
for key, infl in ipairs(data.inflections) do
local this_any_part_translit
data.inflections[key], this_any_part_translit = format_inflection_parts(data, infl)
if this_any_part_translit then
any_part_translit = true
end
end
local concat_result = concat(data.inflections, ", ")
return " (" .. concat_result .. ")"
else
return ""
end
end
--[==[
Returns the plural form of `pos`, a raw part of speech input, which could be singular or
plural. Irregular plural POS are taken into account (e.g. "kanji" pluralizes to
"kanji").
]==]
function export.pluralize_pos(pos)
-- Make the plural form of the part of speech
return (m_data or get_data()).irregular_plurals[pos] or
pos:sub(-1) == "s" and pos or
pluralize(pos)
end
--[==[
Return "lemma" if the given POS is a lemma, "non-lemma form" if a non-lemma form, or nil
if unknown. The POS passed in must be in its plural form ("nouns", "prefixes", etc.).
If you have a POS in its singular form, call {export.pluralize_pos()} above to pluralize it
in a smart fashion that knows when to add "-s" and when to add "-es", and also takes
into account any irregular plurals.
If `best_guess` is given and the POS is in neither the lemma nor non-lemma list, guess
based on whether it ends in " forms"; otherwise, return nil.
]==]
function export.pos_lemma_or_nonlemma(plpos, best_guess)
local isLemma = (m_data or get_data()).lemmas
-- Is it a lemma category?
if isLemma[plpos] then
return "লেমা"
end
local plpos_no_recon = plpos:gsub("^reconstructed ", "")
if isLemma[plpos_no_recon] then
return "লেমা"
end
-- Is it a nonlemma category?
local isNonLemma = (m_data or get_data()).nonlemmas
if isNonLemma[plpos] or isNonLemma[plpos_no_recon] then
return "non-lemma form"
end
local plpos_no_mut = plpos:gsub("^mutated ", "")
if isLemma[plpos_no_mut] or isNonLemma[plpos_no_mut] then
return "non-lemma form"
elseif best_guess then
return plpos:find(" forms$") and "non-lemma form" or "lemma"
else
return nil
end
end
--[==[
Canonicalize a part of speech as specified in 2= in {{tl|head}}. This checks for POS aliases and non-lemma form
aliases ending in 'f', and then pluralizes if the POS term does not have an invariable plural.
]==]
function export.canonicalize_pos(pos)
-- FIXME: Temporary code to throw an error for alias 'pre' (= preposition) that will go away.
if pos == "pre" then
-- Don't throw error on 'pref' as it's an alias for "prefix".
error("POS 'pre' for 'preposition' no longer allowed as it's too ambiguous; use 'prep'")
end
-- Likewise for pro = pronoun.
if pos == "pro" or pos == "prof" then
error("POS 'pro' for 'pronoun' no longer allowed as it's too ambiguous; use 'pron'")
end
local data = m_data or get_data()
if data.pos_aliases[pos] then
pos = data.pos_aliases[pos]
elseif pos:sub(-1) == "f" then
pos = pos:sub(1, -2)
pos = (data.pos_aliases[pos] or pos) .. " forms"
end
return pos
end
-- Find and return the maximum index in the array `data[element]` (which may have gaps in it), and initialize it to a
-- zero-length array if unspecified. Check to make sure all keys are numeric (other than "maxindex", which is set by
-- [[Module:parameters]] for list parameters), all values are strings, and unless `allow_blank_string` is given,
-- no blank (zero-length) strings are present.
local function init_and_find_maximum_index(data, element, allow_blank_string)
local maxind = 0
if not data[element] then
data[element] = {}
end
local typ = type(data[element])
if typ ~= "table" then
error(("In full_headword(), `data.%s` must be an array but is a %s"):format(element, typ))
end
for k, v in pairs(data[element]) do
if k ~= "maxindex" then
if type(k) ~= "number" then
error(("Unrecognized non-numeric key '%s' in `data.%s`"):format(k, element))
end
if k > maxind then
maxind = k
end
if v then
if type(v) ~= "string" then
error(("For key '%s' in `data.%s`, value should be a string but is a %s"):format(k, element, type(v)))
end
if not allow_blank_string and v == "" then
error(("For key '%s' in `data.%s`, blank string not allowed; use 'false' for the default"):format(k, element))
end
end
end
end
return maxind
end
--[==[
-- Add the page to various maintenance categories for the language and the
-- whole page. These are placed in the headword somewhat arbitrarily, but
-- mainly because headword templates are mandatory for entries (meaning that
-- in theory it provides full coverage).
--
-- This is provided as an external entry point so that modules which transclude
-- information from other entries (such as {{tl|ja-see}}) can take advantage
-- of this feature as well, because they are used in place of a conventional
-- headword template.]==]
do
-- Handle any manual sortkeys that have been specified in raw categories
-- by tracking if they are the same or different from the automatically-
-- generated sortkey, so that we can track them in maintenance
-- categories.
local function handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats)
sortkey = sortkey or lang:makeSortKey(page.pagename)
-- If there are raw categories with no sortkey, then they will be
-- sorted based on the default MediaWiki sortkey, so we check against
-- that.
if tbl == true then
if page.raw_defaultsort ~= sortkey then
insert(lang_cats, lang:getFullName() .. " terms with non-redundant non-automated sortkeys")
end
return
end
local redundant, different
for k in pairs(tbl) do
if k == sortkey then
redundant = true
else
different = true
end
end
if redundant then
insert(lang_cats, lang:getFullName() .. " terms with redundant sortkeys")
end
if different then
insert(lang_cats, lang:getFullName() .. " terms with non-redundant non-automated sortkeys")
end
return sortkey
end
function export.maintenance_cats(page, lang, lang_cats, page_cats)
extend(page_cats, page.cats)
lang = lang:getFull() -- since we are just generating categories
local canonical = lang:getCanonicalName()
local tbl, sortkey = page.wikitext_topic_cat[lang:getCode()]
if tbl then
sortkey = handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats)
insert(lang_cats, canonical .. " entries with topic categories using raw markup")
end
tbl = page.wikitext_langname_cat[canonical]
if tbl then
handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats)
insert(lang_cats, canonical .. " entries with language name categories using raw markup")
end
-- if get_current_L2() ~= canonical then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/incorrect language header]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/incorrect language header/LANGCODE]]
-- track("incorrect language header", lang)
-- end
end
end
--[==[This is the primary external entry point.
{{lua|full_headword(data)}}
This is used by {{temp|head}} and various language-specific headword templates (e.g. {{temp|ru-adj}} for Russian adjectives, {{temp|de-noun}} for German nouns, etc.) to display an entire headword line.
See [[#Further explanations for full_headword()]]
]==]
function export.full_headword(data)
-- Prevent data from being destructively modified.
local data = shallow_copy(data)
------------ 1. Basic checks for old-style (multi-arg) calling convention. ------------
if data.getCanonicalName then
error("In full_headword(), the first argument `data` needs to be a Lua object (table) of properties, not a language object")
end
if not data.lang or type(data.lang) ~= "table" or not data.lang.getCode then
error("In full_headword(), the first argument `data` needs to be a Lua object (table) and `data.lang` must be a language object")
end
if data.id and type(data.id) ~= "string" then
error("The id in the data table should be a string.")
end
------------ 2. Initialize pagename etc. ------------
local langcode = data.lang:getCode()
local full_langcode = data.lang:getFullCode()
local langname = data.lang:getCanonicalName()
local full_langname = data.lang:getFullName()
local raw_pagename, page = data.pagename
if raw_pagename and raw_pagename ~= (m_data or get_data()).pagename then -- for testing, doc pages, etc.
page = process_page(raw_pagename)
else
page = (m_data or get_data()).page
end
-- Check the namespace against the language type.
local namespace = page.namespace
if namespace == "" then
if data.lang:hasType("reconstructed") then
error("Entries in " .. langname .. " must be placed in the Reconstruction: namespace")
elseif data.lang:hasType("appendix-constructed") then
error("Entries in " .. langname .. " must be placed in the Appendix: namespace")
end
elseif namespace == "Citations" or namespace == "Thesaurus" then
error("Headword templates should not be used in the " .. namespace .. ": namespace.")
end
------------ 3. Initialize `data.heads` table; if old-style, convert to new-style. ------------
if type(data.heads) == "table" and type(data.heads[1]) == "table" then
-- new-style
if data.translits or data.transcriptions then
error("In full_headword(), if `data.heads` is new-style (array of head objects), `data.translits` and `data.transcriptions` cannot be given")
end
else
-- convert old-style `heads`, `translits` and `transcriptions` to new-style
local maxind = max(
init_and_find_maximum_index(data, "heads"),
init_and_find_maximum_index(data, "translits", true),
init_and_find_maximum_index(data, "transcriptions", true)
)
for i = 1, maxind do
data.heads[i] = {
term = data.heads[i],
tr = data.translits[i],
ts = data.transcriptions[i],
}
end
end
-- Make sure there's at least one head.
if not data.heads[1] then
data.heads[1] = {}
end
------------ 4. Initialize and validate `data.categories` and `data.whole_page_categories`, and determine `pos_category` if not given, and add basic categories. ------------
-- EXPERIMENTAL: see [[Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
if data.altform then
data.noposcat = true
end
init_and_find_maximum_index(data, "categories")
init_and_find_maximum_index(data, "whole_page_categories")
local pos_category_already_present = false
if data.categories[1] then
local escaped_langname = pattern_escape(full_langname)
local matches_lang_pattern = "^" .. escaped_langname .. " "
for _, cat in ipairs(data.categories) do
-- Does the category begin with the language name? If not, tag it with a tracking category.
if not cat:find(matches_lang_pattern) then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/no lang category]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/no lang category/LANGCODE]]
track("no lang category", data.lang)
end
end
-- If `pos_category` not given, try to infer it from the first specified category. If this doesn't work, we
-- throw an error below.
if not data.pos_category and data.categories[1]:find(matches_lang_pattern) then
data.pos_category = data.categories[1]:gsub(matches_lang_pattern, "")
-- Optimization to avoid inserting category already present.
pos_category_already_present = true
end
end
if not data.pos_category then
error("`data.pos_category` not specified and could not be inferred from the categories given in "
.. "`data.categories`. Either specify the plural part of speech in `data.pos_category` "
.. "(e.g. \"proper nouns\") or ensure that the first category in `data.categories` is formed from the "
.. "language's canonical name plus the plural part of speech (e.g. \"Norwegian Bokmål proper nouns\")."
)
end
-- Insert a category at the beginning for the part of speech unless it's already present or `data.noposcat` given.
if not pos_category_already_present and not data.noposcat then
local pos_category = full_langname .. " " .. data.pos_category
-- FIXME: [[User:Theknightwho]] Why is this special case here? Please add an explanatory comment.
if pos_category ~= "Translingual Han characters" then
insert(data.categories, 1, pos_category)
end
end
-- Try to determine whether the part of speech refers to a lemma or a non-lemma form; if we can figure this out,
-- add an appropriate category.
local postype = export.pos_lemma_or_nonlemma(data.pos_category)
if not postype then
-- We don't know what this category is, so tag it with a tracking category.
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/unrecognized pos]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/unrecognized pos/LANGCODE]]
track("unrecognized pos", data.lang)
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/unrecognized pos/POS]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/unrecognized pos/POS/LANGCODE]]
track("unrecognized pos/pos/" .. data.pos_category, data.lang)
elseif not data.noposcat then
insert(data.categories, 1, full_langname .. " " .. postype)
end
-- EXPERIMENTAL: see [[Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
if data.altform then
insert(data.categories, 1, full_langname .. " alternative forms")
end
------------ 5. Create a default headword, and add links to multiword page names. ------------
-- Determine if term is reconstructed
local is_reconstructed = namespace == "Reconstruction" or data.lang:hasType("reconstructed")
-- Create a default headword based on the pagename, which is determined in
-- advance by the data module so that it only needs to be done once.
local default_head = page.pagename
-- Add links to multi-word page names when appropriate
if not (is_reconstructed or data.nolinkhead) then
local no_links = (m_data or get_data()).no_multiword_links
if not (no_links[langcode] or no_links[full_langcode]) and export.head_is_multiword(default_head) then
default_head = export.add_multiword_links(default_head, true)
end
end
if is_reconstructed then
default_head = "*" .. default_head
end
------------ 6. Fill in missing values in `data.heads`. ------------
-- True if any script among the headword scripts has spaces in it.
local any_script_has_spaces = false
-- True if any term has a redundant head= param.
local has_redundant_head_param = false
for _, head in ipairs(data.heads) do
------ 6a. If missing head, replace with default head.
if not head.term then
head.term = default_head
elseif head.term == default_head then
has_redundant_head_param = true
elseif head.term:find("^[!?]$") then
-- If explicit head= just consists of ! or ?, add it to the end of the default head.
head.term = default_head .. head.term
end
if is_reconstructed then
local head_term = head.term
if head_term:find("%[%[") then
head_term = remove_links(head_term)
end
if head_term:sub(1, 1) ~= "*" then
error("The headword '" .. head_term .. "' must begin with '*' to indicate that it is reconstructed.")
end
end
------ 6b. Try to detect the script(s) if not provided. If a per-head script is provided, that takes precedence,
------ otherwise fall back to the overall script if given. If neither given, autodetect the script.
local auto_sc = data.lang:findBestScript(head.term)
if (
auto_sc:getCode() == "None" and
find_best_script_without_lang(head.term):getCode() ~= "None"
) then
insert(data.categories, full_langname .. " terms in nonstandard scripts")
end
if not (head.sc or data.sc) then -- No script code given, so use autodetected script.
head.sc = auto_sc
else
if not head.sc then -- Overall script code given.
head.sc = data.sc
end
-- Track uses of sc parameter.
if head.sc:getCode() == auto_sc:getCode() then
insert(data.categories, full_langname .. " terms with redundant script codes")
else
insert(data.categories, full_langname .. " terms with non-redundant manual script codes")
end
end
-- If using a discouraged character sequence, add to maintenance category.
if head.sc:hasNormalizationFixes() == true then
local composed_head = toNFC(head.term)
if head.sc:fixDiscouragedSequences(composed_head) ~= composed_head then
insert(data.whole_page_categories, "Pages using discouraged character sequences")
end
end
any_script_has_spaces = any_script_has_spaces or head.sc:hasSpaces()
------ 6c. Create automatic transliterations for any non-Latin headwords without manual translit given
------ (provided automatic translit is available, e.g. not in Persian or Hebrew).
-- Make transliterations
head.tr_manual = nil
-- Try to generate a transliteration if necessary
if head.tr == "-" then
head.tr = nil
else
local notranslit = (m_data or get_data()).notranslit
if not (notranslit[langcode] or notranslit[full_langcode]) and head.sc:isTransliterated() then
head.tr_manual = not not head.tr
local text = head.term
if not data.lang:link_tr(head.sc) then
text = remove_links(text)
end
local automated_tr, tr_categories
automated_tr, head.tr_fail, tr_categories = data.lang:transliterate(text, head.sc)
if automated_tr or head.tr_fail then
local manual_tr = head.tr
if manual_tr then
if (remove_links(manual_tr) == remove_links(automated_tr)) and (not head.tr_fail) then
insert(data.categories, full_langname .. " terms with redundant transliterations")
elseif not head.tr_fail then
insert(data.categories, full_langname .. " terms with non-redundant manual transliterations")
end
end
if not manual_tr then
head.tr = automated_tr
extend(data.categories, tr_categories)
end
end
-- There is still no transliteration?
-- Add the entry to a cleanup category.
if not head.tr then
head.tr = "<small>প্রতিবর্ণীকরণ প্রয়োজন</small>"
-- FIXME: No current support for 'Request for transliteration of Classical Persian terms' or similar.
-- Consider adding this support in [[Module:category tree/poscatboiler/data/entry maintenance]].
insert(data.categories, full_langname .. " শব্দের প্রতিবর্ণীকরণের জন্য অনুরোধ")
else
-- Otherwise, trim it.
head.tr = trim(head.tr)
end
end
end
-- Link to the transliteration entry for languages that require this.
if head.tr and data.lang:link_tr(head.sc) then
head.tr = full_link{
term = head.tr,
lang = data.lang,
sc = get_script("Latn"),
tr = "-"
}
end
end
------------ 7. Maybe tag the title with the appropriate script code, using the `display_title` mechanism. ------------
-- Assumes that the scripts in "toBeTagged" will never occur in the Reconstruction namespace.
-- (FIXME: Don't make assumptions like this, and if you need to do so, throw an error if the assumption is violated.)
-- Avoid tagging ASCII as Hani even when it is tagged as Hani in the headword, as in [[check]]. The check for ASCII
-- might need to be expanded to a check for any Latin characters and whitespace or punctuation.
local display_title
-- Where there are multiple headwords, use the script for the first. This assumes the first headword is similar to
-- the pagename, and that headwords that are in different scripts from the pagename aren't first. This seems to be
-- about the best we can do (alternatively we could potentially do script detection on the pagename).
local dt_script = data.heads[1].sc
local dt_script_code = dt_script:getCode()
local page_non_ascii = namespace == "" and not page.pagename:find("^[%z\1-\127]+$")
local unsupported_pagename, unsupported = page.full_raw_pagename:gsub("^Unsupported titles/", "")
if unsupported == 1 and page.unsupported_titles[unsupported_pagename] then
display_title = 'Unsupported titles/<span class="' .. dt_script_code .. '">' .. page.unsupported_titles[unsupported_pagename] .. '</span>'
elseif page_non_ascii and (m_data or get_data()).toBeTagged[dt_script_code]
or (dt_script_code == "Jpan" and (text_in_script(page.pagename, "Hira") or text_in_script(page.pagename, "Kana")))
or (dt_script_code == "Kore" and text_in_script(page.pagename, "Hang")) then
display_title = '<span class="' .. dt_script_code .. '">' .. page.full_raw_pagename .. '</span>'
-- Keep Han entries region-neutral in the display title.
elseif page_non_ascii and (dt_script_code == "Hant" or dt_script_code == "Hans") then
display_title = '<span class="Hani">' .. page.full_raw_pagename .. '</span>'
elseif namespace == "Reconstruction" then
local matched
display_title, matched = ugsub(
page.full_raw_pagename,
"^(Reconstruction:[^/]+/)(.+)$",
function(before, term)
return before .. tag_text(term, data.lang, dt_script)
end
)
if matched == 0 then
display_title = nil
end
end
-- FIXME: Generalize this.
-- If the current language uses ur-Arab (for Urdu, etc.), ku-Arab (Central Kurdish) or pa-Arab
-- (Shahmukhi, for Punjabi) and there's more than one language on the page, don't set the display title
-- because these three scripts display in Nastaliq and we don't want this for terms that also exist in other
-- languages that don't display in Nastaliq (e.g. Arabic or Persian) to display in Nastaliq. Because the word
-- "Urdu" occurs near the end of the alphabet, Urdu fonts tend to override the fonts of other languages.
-- FIXME: This is checking for more than one language on the page but instead needs to check if there are any
-- languages using scripts other than the ones just mentioned.
if (dt_script_code == "ur-Arab" or dt_script_code == "ku-Arab" or dt_script_code == "pa-Arab") and page.L2_list.n > 1 then
display_title = nil
end
if display_title then
mw.getCurrentFrame():callParserFunction(
"DISPLAYTITLE",
display_title
)
end
------------ 8. Insert additional categories. ------------
if data.force_cat_output then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/force cat output]]
track("force cat output")
end
if has_redundant_head_param then
if not data.no_redundant_head_cat then
insert(data.categories, full_langname .. " terms with redundant head parameter")
end
end
-- If the first head is multiword (after removing links), maybe insert into "LANG multiword terms".
if not data.nomultiwordcat and any_script_has_spaces and postype == "lemma" then
local no_multiword_cat = (m_data or get_data()).no_multiword_cat
if not (no_multiword_cat[langcode] or no_multiword_cat[full_langcode]) then
-- Check for spaces or hyphens, but exclude prefixes and suffixes.
-- Use the pagename, not the head= value, because the latter may have extra
-- junk in it, e.g. superscripted text that throws off the algorithm.
local no_hyphen = (m_data or get_data()).hyphen_not_multiword_sep
-- Exclude hyphens if the data module states that they should for this language.
local checkpattern = (no_hyphen[langcode] or no_hyphen[full_langcode]) and ".[%s፡]." or ".[%s%-፡]."
if umatch(page.pagename, checkpattern) and not non_categorizable(page.full_raw_pagename) then
insert(data.categories, full_langname .. " multiword terms")
end
end
end
if data.sccat then
for _, head in ipairs(data.heads) do
insert(data.categories, full_langname .. " " .. data.pos_category .. " in " ..
head.sc:getDisplayForm())
end
end
-- Reconstructed terms often use weird combinations of scripts and realistically aren't spelled so much as notated.
if namespace ~= "Reconstruction" then
-- Map from languages to a string containing the characters to ignore when considering whether a term has
-- multiple written scripts in it. Typically these are Greek or Cyrillic letters used for their phonetic
-- values.
local characters_to_ignore = {
["aaq"] = "α", -- Penobscot
["acy"] = "δθ", -- Cypriot Arabic
["anc"] = "γ", -- Ngas
["aou"] = "χ", -- A'ou
["awg"] = "β", -- Anguthimri
["bhp"] = "β", -- Bima
["byk"] = "θ", -- Biao
["cdy"] = "θ", -- Chadong
["clm"] = "χ", -- Klallam
["col"] = "χ", -- Colombia-Wenatchi
["coo"] = "χ", -- Comox; FIXME: others? E.g. Greek theta (θ)?
["ets"] = "θ", -- Yekhee
["gmw-gts"] = "χ", -- Gottscheerish
["hur"] = "θ", -- Halkomelem
["izh"] = "ь", -- Ingrian
["kic"] = "θ", -- Kickapoo
["lil"] = "χ", -- Lillooet
["mhz"] = "β", -- Mor (Austronesian)
["neg"]= "ӡ", -- Negidal (normally in Cyrillic)
["oui"] = "γβ", -- Old Uyghur: FIXME: others? E.g. Greek delta (δ)?
["pox"] = "χ", -- Polabian
["rom"] = "Θθ", -- Romani: International Standard; two different thetas???
["sah"] = "ь", -- Yakut (1929 - 1939 Latin spelling)
["sjw"] = "θ", -- Shawnee
["squ"] = "χ", -- Squamish
["str"] = "χθ", -- Saanich; uses two Greek letters
["twa"] = "χ", -- Twana
["yha"] = "θ", -- Baha
["za"] = "зч", -- Zhuang; 1957-1982 alphabet used two Cyrillic letters (as well as some others like
-- ƃ, ƅ, ƨ, ɯ and ɵ that look like Cyrillic or Greek but are actually Latin)
["zlw-slv"] = "χђћ", -- Slovincian; FIXME: χ is Greek, the other two are Cyrillic, but I'm not sure
-- the currect characters are being chosen in the entry names
["zng"] = "θ", -- Mang
}
-- Determine how many real scripts are found in the pagename, where we exclude symbols and such. We exclude
-- scripts whose `character_category` is false as well as Zmth (mathematical notation symbols), which has a
-- category of "Mathematical notation symbols". When counting scripts, we need to elide language-specific
-- variants because e.g. Beng and as-Beng have slightly different characters but we don't want to consider them
-- two different scripts (e.g. [[এৰ]] has two characters which are detected respectively as Beng and as-Beng).
local seen_scripts = {}
local num_seen_scripts = 0
local num_loops = 0
local canon_pagename = page.pagename
local ch_to_ignore = characters_to_ignore[full_langcode]
if ch_to_ignore then
canon_pagename = ugsub(canon_pagename, "[" .. ch_to_ignore .. "]", "")
end
while true do
if canon_pagename == "" or num_seen_scripts >= 2 or num_loops >= 10 then
break
end
-- Make sure we don't get into a loop checking the same script over and over again; happens with e.g. [[ᠪᡳ]]
num_loops = num_loops + 1
local pagename_script = find_best_script_without_lang(canon_pagename, "None only as last resort")
local script_chars = pagename_script.characters
if not script_chars then
-- we are stuck; this happens with None
break
end
local script_code = pagename_script:getCode()
local replaced
canon_pagename, replaced = ugsub(canon_pagename, "[" .. script_chars .. "]", "")
if (
replaced and
script_code ~= "Zmth" and
(script_data or get_script_data())[script_code] and
script_data[script_code].character_category ~= false
) then
script_code = script_code:gsub("^.-%-", "")
if not seen_scripts[script_code] then
seen_scripts[script_code] = true
num_seen_scripts = num_seen_scripts + 1
end
end
end
if num_seen_scripts > 1 then
insert(data.categories, full_langname .. " terms written in multiple scripts")
end
end
-- Categorise for unusual characters. Takes into account combining characters, so that we can categorise for characters with diacritics that aren't encoded as atomic characters (e.g. U̠). These can be in two formats: single combining characters (i.e. character + diacritic(s)) or double combining characters (i.e. character + diacritic(s) + character). Each can have any number of diacritics.
local standard = data.lang:getStandardCharacters()
if standard and not non_categorizable(page.full_raw_pagename) then
local function char_category(char)
local specials = {
["#"] = "number sign",
["("] = "parentheses",
[")"] = "parentheses",
["<"] = "angle brackets",
[">"] = "angle brackets",
["["] = "square brackets",
["]"] = "square brackets",
["_"] = "underscore",
["{"] = "braces",
["|"] = "vertical line",
["}"] = "braces",
["ß"] = "ẞ",
["\205\133"] = "", -- this is UTF-8 for U+0345 ( ͅ)
["\239\191\189"] = "replacement character",
}
char = toNFD(char)
:gsub(".[\128-\191]*", function(m)
local new_m = specials[m]
new_m = new_m or m:uupper()
return new_m
end)
return toNFC(char)
end
if full_langcode ~= "hi" and full_langcode ~= "lo" then
local standard_chars_scripts = {}
for _, head in ipairs(data.heads) do
standard_chars_scripts[head.sc:getCode()] = true
end
-- Iterate over the scripts, in case there is more than one (as they can have different sets of standard characters).
for code in pairs(standard_chars_scripts) do
local sc_standard = data.lang:getStandardCharacters(code)
if sc_standard then
if page.pagename_len > 1 then
local explode_standard = {}
local function explode(char)
explode_standard[char] = true
return ""
end
local sc_standard = ugsub(sc_standard, page.comb_chars.combined_double, explode)
sc_standard = ugsub(sc_standard,page.comb_chars.combined_single, explode)
:gsub(".[\128-\191]*", explode)
local num_cat_inserted
for char in pairs(page.explode_pagename) do
if not explode_standard[char] then
if char:find("[0-9]") then
if not num_cat_inserted then
insert(data.categories, full_langname .. " terms spelled with numbers")
num_cat_inserted = true
end
elseif ufind(char, page.emoji_pattern) then
insert(data.categories, full_langname .. " terms spelled with emoji")
else
local upper = char_category(char)
if not explode_standard[upper] then
char = upper
end
insert(data.categories, full_langname .. " terms spelled with " .. char)
end
end
end
end
-- If a diacritic doesn't appear in any of the standard characters, also categorise for it generally.
sc_standard = toNFD(sc_standard)
for diacritic in ugmatch(page.decompose_pagename, page.comb_chars.diacritics_single) do
if not umatch(sc_standard, diacritic) then
insert(data.categories, full_langname .. " terms spelled with ◌" .. diacritic)
end
end
for diacritic in ugmatch(page.decompose_pagename, page.comb_chars.diacritics_double) do
if not umatch(sc_standard, diacritic) then
insert(data.categories, full_langname .. " terms spelled with ◌" .. diacritic .. "◌")
end
end
end
end
-- Ancient Greek, Hindi and Lao handled the old way for now, as their standard chars still need to be converted to the new format (because there are a lot of them).
elseif ulen(page.pagename) ~= 1 then
for character in ugmatch(page.pagename, "([^" .. standard .. "])") do
local upper = char_category(character)
if not umatch(upper, "[" .. standard .. "]") then
character = upper
end
insert(data.categories, full_langname .. " terms spelled with " .. character)
end
end
end
if data.heads[1].sc:isSystem("alphabet") then
local pagename, i = page.pagename:ulower(), 2
while umatch(pagename, "(%a)" .. ("%1"):rep(i)) do
i = i + 1
insert(data.categories, full_langname .. " terms with " .. i .. " consecutive instances of the same letter")
end
end
-- Categorise for palindromes
if not data.nopalindromecat and namespace ~= "Reconstruction" and ulen(page.pagename) > 2
-- FIXME: Use of first script here seems hacky. What is the clean way of doing this in the presence of
-- multiple scripts?
and is_palindrome(page.pagename, data.lang, data.heads[1].sc) then
insert(data.categories, full_langname .. " palindromes")
end
if namespace == "" and not data.lang:hasType("reconstructed") then
for _, head in ipairs(data.heads) do
if page.full_raw_pagename ~= get_link_page(remove_links(head.term), data.lang, head.sc) then
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/pagename spelling mismatch]]
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/pagename spelling mismatch/LANGCODE]]
track("pagename spelling mismatch", data.lang)
break
end
end
end
-- Add to various maintenance categories.
export.maintenance_cats(page, data.lang, data.categories, data.whole_page_categories)
------------ 9. Format and return headwords, genders, inflections and categories. ------------
-- Format and return all the gathered information. This may add more categories (e.g. gender/number categories),
-- so make sure we do it before evaluating `data.categories`.
local text = '<span class="headword-line">' ..
format_headword(data) ..
format_headword_genders(data) ..
format_inflections(data) .. '</span>'
-- Language-specific categories.
local cats = format_categories(
data.categories, data.lang, data.sort_key, page.encoded_pagename,
data.force_cat_output or test_force_categories, data.heads[1].sc
)
-- Language-agnostic categories.
local whole_page_cats = format_categories(
data.whole_page_categories, nil, "-"
)
return text .. cats .. whole_page_cats
end
return export
ortyqyfvvg4wkgf9z8c479wfaccv8l6
pizza
0
29870
509624
90140
2026-06-03T06:24:32Z
Redmin
6857
লেক্সিম লিংকার এক্সটেনশনের সাহায্যে উইকিউপাত্ত লেক্সিম L32383-এর সাথে সংযোগ তৈরি করছি
509624
wikitext
text/x-wiki
{{আরও দেখুন|Pizza}}
== {{langname|en}} ==
=== উচ্চারণ ===
* {{উচ্চারণ-ভঙ্গি|RP}} {{আধ্বব|en|/ˈpiːt.sə/}}
* {{উচ্চারণ-ভঙ্গি|GA}} {{আধ্বব|en|/ˈpitsə/|}}
* {{অডিও|en|en-us-pizza.ogg|অডিও (যুক্তরাষ্ট্র)}}
=== বিশেষ্য ===
{{en-বিশেষ্য|~|s|pizze|pl3qual=rare}}
# [[পিজা]]
{{লে|L32383}}
297774574n3jtrjo5vvbydlnfeh1kby
মডিউল:আভিধানিক উপাত্ত
828
50158
509626
509487
2026-06-03T09:55:35Z
Redmin
6857
509626
Scribunto
text/plain
local p = {}
local i18n = require('মডিউল:আভিধানিক উপাত্ত/i18n')
local references = require('মডিউল:উইকিউপাত্ত তথ্যসূত্র বিন্যাসকরণ').format
local getArgs = require('Module:Arguments').getArgs
local wb = mw.wikibase
local ustring = mw.ustring
local html = mw.html
local mw_lang = mw.language
local entity_cache = {}
local reference_cache = {}
local forms
local lang_code
local lex_cat
local matched_lemma
local function wrapStringInWikilinks(str)
local exceptions = i18n.nolinks
local result = str:gsub('(%S+)', function(token)
local word, trailing_char = token:match('^(.-)([;,]*)$')
local wrapped = word:gsub('[^(-/]+', function(part)
if exceptions[part] then
return part
else
return '[[' .. part .. '#' .. i18n['content_lang_name'] .. '|' .. part .. ']]'
end
end)
return wrapped .. trailing_char
end)
return result
end
local function serializeTable(val, name, skipnewlines, depth) -- https://stackoverflow.com/a/6081639
skipnewlines = skipnewlines or false
depth = depth or 0
local tmp = string.rep(" ", depth)
if name then tmp = tmp .. name .. " = " end
if type(val) == "table" then
tmp = tmp .. "{" .. (not skipnewlines and "\n" or "")
for k, v in pairs(val) do
tmp = tmp .. serializeTable(v, k, skipnewlines, depth + 1) .. "," .. (not skipnewlines and "\n" or "")
end
tmp = tmp .. string.rep(" ", depth) .. "}"
elseif type(val) == "number" then
tmp = tmp .. tostring(val)
elseif type(val) == "string" then
tmp = tmp .. string.format("%q", val)
elseif type(val) == "boolean" then
tmp = tmp .. (val and "true" or "false")
else
tmp = tmp .. "\"[inserializeable datatype:" .. type(val) .. "]\""
end
return tmp
end
-- Use this to safely expand templates when you are not sure that they exist.
local function safeExpand(frame, title, args)
local _, result = pcall(function()
return frame:expandTemplate{ title = title, args = args }
end)
if result:find('does not exist') then -- expandTemplate{} doesn't seem to throw any error that can be handled with pcall() so string search is the only viable option.
return nil
end
return result
end
-- Use this function to get the label of an item even if that item does not have any label in the wiki's content language or English.
local function getLabel(id)
if id == 'Q11051hi' then
return 'হিন্দি'
elseif id == 'Q11051ur' then
return 'উর্দু'
elseif id == 'Q56356571fa' then
return 'নয়া ফার্সি'
elseif id == 'Q56356571tg' then
return 'তাজিক'
elseif id == 'Q58635pa' or id == 'Q58635pnb' then
return 'পাঞ্জাবি'
end
local label = wb.getLabel(id)
if label then
return label
end
local labels = wb.getEntity(id).labels
if not labels then
return id
end
for _, v in pairs(labels) do
if v and v.value then
return v.value
end
end
end
local function getReference( id, reference )
local out_id = nil
local url_value
if reference_cache[id] == nil then
local ref_text = references(reference, wb, mw_lang, i18n['content_lang_code'], i18n['wikipedia'])
if reference.snaks then
if reference.snaks['P248'] then
for _, snak in pairs(reference.snaks['P248']) do
if snak.datavalue and snak.datavalue.value.id == 'Q428' then -- কুরআন
ref_text = ustring.gsub(ref_text, 'নামক অনুচ্ছেদ', 'নং আয়াত')
break
end
end
end
if reference.snaks['P854'] then
local snak = reference.snaks['P854'][1]
if snak.datavalue then
url_value = snak.datavalue.value
end
end
end
if url_value then
ref_text = ref_text .. ', [' .. url_value .. ' সংযোগ]'
end
reference_cache[id] = ref_text
else
out_id = id
end
return {out_id, reference_cache[id]}
end
local function getEntity( id )
if entity_cache[id] == nil then
entity_cache[id] = wb.getEntity(id)
end
return entity_cache[id] ~= false and entity_cache[id] or nil
end
local function getLexemeLanguageCode(current_lexeme)
local lang_item_id = current_lexeme:getLanguage()
if lang_item_id == nil then
return nil
end
local lang_entity = getEntity(lang_item_id)
if lang_entity == nil then
return nil
end
for i, statement_property in ipairs({'P305','P424', 'P220'}) do -- আইইটিএফ ভাষা ট্যাগ, উইকিমিডিয়া ভাষা কোড, আইএসও ৬৩৯-৩
local statements = lang_entity:getBestStatements(statement_property)
if statements[1] then
return statements[1].mainsnak.datavalue.value
end
end
return nil
end
-- Return the first form of the lexeme which has exactly the given grammatical feature.
local function formWithSingleGrammaticalFeature( item_id )
for i = 1, #forms do
local grammaticalFeatures = forms[i]:getGrammaticalFeatures()
if #grammaticalFeatures == 1 and grammaticalFeatures[1] == item_id then
return forms[i]
end
end
return nil
end
local function getArticleLinkTemplate(frame, stmt_value)
local template = ''
local sitelink = getEntity(stmt_value):getSitelink(i18n['wikipedia'])
if sitelink then
template = frame:expandTemplate{
title=i18n['template_wikipedia'],
args={sitelink}
}
end
return template
end
local function getArticleLinks (frame, sense )
local article_links = ''
for i, stmt in pairs(sense:getAllStatements('P5137')) do -- এই অর্থের জন্য আইটেম
article_links = article_links .. getArticleLinkTemplate(frame, stmt.mainsnak.datavalue.value.id)
end
for i, stmt in pairs(sense:getAllStatements('P9970')) do -- এই অর্থের জন্য বিধেয়
article_links = article_links .. getArticleLinkTemplate(frame, stmt.mainsnak.datavalue.value.id)
end
return article_links
end
-- @TODO: Generalise
local function expandTemplateForProperty(frame, object, property, template)
local lemmas = {}
local n = 0
for _, stmt in pairs(object:getAllStatements(property)) do
local lex = wb.lexeme.splitLexemeId(stmt.mainsnak.datavalue.value.id)
if lex then
lex = getEntity(lex)
n = n + 1
lemmas[n] = lex:getLemma(lang_code)
end
end
if not lang_code or n == 0 then
return ''
end
-- Build args: first lang_code, then lemmas
local args = {lang_code}
for i = 1, n do
args[#args + 1] = lemmas[i]
end
return frame:expandTemplate{
title = template,
args = args
}
end
local function getExternalLinks( entity ) -- T418639
local external_links = {}
if entity.claims == nil then return external_links end
local formatter_urls = require('মডিউল:আভিধানিক উপাত্ত/urls').formatter_urls
for property_id, statements in pairs(entity.claims) do
local formatter_url = formatter_urls[property_id]
if formatter_url then
local property_source = wb.getBestStatements(property_id, 'P9073')
local source_name
if next(property_source) then
source_name = getLabel(property_source[1].mainsnak.datavalue.value.id)
or property_source[1].mainsnak.datavalue.value.id
else
source_name = getLabel(property_id) or property_id
end
for i = 1, #statements do
local stmt = statements[i]
if stmt.mainsnak.datavalue then
local formatted_link = ustring.gsub(
ustring.gsub(formatter_url, '$1', ustring.gsub(stmt.mainsnak.datavalue.value, '%%', '%%%%')),
' ', '+'
)
table.insert(external_links,
'[' .. formatted_link .. ' ' .. source_name .. ']')
end
end
end
end
return external_links
end
p.getExternalLinks = getExternalLinks -- রেখে দিন যাতে ডিবাগিং সম্ভব হয়
local function termSpan( term )
local text = term[1]
local lang = term[2]
local dir = mw_lang.new( lang ):getDir()
local span = html.create( 'span' )
span:attr( 'lang', lang )
:attr( 'dir', dir )
:wikitext( text )
return tostring( span )
end
local function termLink( term, lang_qid )
local text = term[1]
local lang = term[2]
local dir = mw_lang.new( lang ):getDir()
local span = html.create( 'span' )
span:attr( 'lang', lang )
:attr( 'dir', dir )
:wikitext( '[[' .. text .. '#' .. getLabel(lang_qid) .. '|' .. text .. ']]' )
return tostring( span )
end
local function getLemmata( current_lexeme )
local lemma_string = ''
for i, rep in pairs(current_lexeme:getLemmas()) do
if lemma_string == '' then
lemma_string = termSpan(rep)
else
lemma_string = lemma_string .. '/' .. termSpan(rep)
end
end
return lemma_string
end
local function getLinkedLemmata( current_lexeme )
local lemma_string = ''
for i, rep in pairs(current_lexeme:getLemmas()) do
if lemma_string == '' then
lemma_string = termLink(rep, current_lexeme:getLanguage())
else
lemma_string = lemma_string .. '/' .. termLink(rep, current_lexeme:getLanguage())
end
end
return lemma_string
end
local function getExamples( current_lexeme, sense_id, references_seen )
local examples = html.create('dl')
local example_text, example_lang, example_form, example_str
for i, stmt in pairs(current_lexeme:getAllStatements('P5831')) do -- ব্যবহারের উদাহরণ
if stmt.qualifiers and stmt.qualifiers['P6072'] and stmt.qualifiers['P6072'][1].datavalue.value.id == sense_id then -- বিষয়ে লেক্সিমের অর্থ
example_text = ustring.gsub(stmt.mainsnak.datavalue.value.text, ' / ','<br/>')
example_lang = stmt.mainsnak.datavalue.value.language
local example_form_strs = {}
if stmt.qualifiers['P1810'] then
table.insert(example_form_strs, stmt.qualifiers['P1810'][1].datavalue.value)
elseif stmt.qualifiers['P5830'] then
example_form = getEntity(stmt.qualifiers['P5830'][1].datavalue.value.id) -- বিষয়ে লেক্সিমের রূপ
for _, rep in pairs(example_form:getRepresentations()) do
table.insert(example_form_strs, rep[1])
end
end
for i, example_form_str in pairs(example_form_strs) do
new_example_text = ustring.gsub(example_text, example_form_str, "'''" .. example_form_str .. "'''")
if new_example_text ~= example_text then
example_str = termSpan({new_example_text, example_lang})
break
end
new_example_text = example_text
end
if example_str == nil then
example_str = termSpan({example_text, example_lang})
end
local reference_text = ''
if stmt.references then
for j, reference in pairs(stmt.references) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. got_reference[2]
end
end
if example_str then
examples:tag('dd'):wikitext("''" .. example_str .. "''")
if reference_text ~= '' then
examples:done():tag('dd'):css('text-indent', '2em'):wikitext(reference_text)
end
end
end
end
for i, stmt in pairs(wb.getAllStatements(sense_id, 'P5831')) do -- ব্যবহারের উদাহরণ
example_text = ustring.gsub(stmt.mainsnak.datavalue.value.text, ' / ','<br/>')
example_lang = stmt.mainsnak.datavalue.value.language
local example_form_str = nil
if stmt.qualifers then
example_form = getEntity(stmt.qualifiers['P5830'][1].datavalue.value.id) -- বিষয়ে লেক্সিমের রূপ
if stmt.qualifiers['P1810'] then
example_form_str = stmt.qualifiers['P1810'][1].datavalue.value
end
end
if example_form and example_form_str == nil then
example_form_str = example_form:getRepresentation(i18n['content_lang_code'])
end
if example_form and example_form_str == nil then
example_form_str = example_form:getRepresentations()[1][1]
end
if example_form_str then
example_text = ustring.gsub(example_text, example_form_str, "'''" .. example_form_str .. "'''")
end
example_str = termSpan({example_text, example_lang})
local reference_text = ''
if stmt.references then
for j, reference in pairs(stmt.references) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. got_reference[2]
end
end
if example_str then
examples:tag('dd'):wikitext("''" .. example_str .. "''")
if reference_text ~= '' then
examples:done():tag('dd'):css('text-indent', '2em'):wikitext(reference_text)
end
end
end
return { tostring(examples) , references_seen }
end
-- This calls frame:preprocess() instead of :callParserFunction() because the latter does not work for Wikifunctions function calls yet (see https://www.wikifunctions.org/wiki/Wikifunctions:Embedded_function_calls).
local function callWikifunctionsFunction(args, frame)
return frame:preprocess('{{#function:' .. args .. '}}')
end
local function checkTitleCodePointInRange(title, start_point, end_point)
return ustring.find( title, '[' ..ustring.char(start_point) .. '-' .. ustring.char(end_point) .. ']' )
end
local function getLanguageForCategories( lang_id, current_page_title )
-- বিশেষ ভাষার জন্য
if lang_id == 'Q11051' then -- হিন্দি/উর্দু
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- উর্দু
lang_id = 'Q11051ur'
elseif checkTitleCodePointInRange(current_page_title, 0x0900, 0x097f) then -- হিন্দি
lang_id = 'Q11051hi'
end
elseif lang_id == 'Q58635' then -- পাঞ্জাবি
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- শাহমুখী
lang_id = 'Q58635pnb'
elseif checkTitleCodePointInRange(current_page_title, 0x0a00, 0x0a7f) then -- গুরুমুখী
lang_id = 'Q58635pa'
end
elseif lang_id == 'Q56356571' then -- নয়া ফার্সি ভাষা
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- ফার্সি (ইরান/আফগানিস্তান)
lang_id = 'Q56356571fa'
elseif checkTitleCodePointInRange(current_page_title, 0x0400, 0x04ff) then -- তাজিক
lang_id = 'Q56356571tg'
end
end
return lang_id
end
local function getOneStringForProperty(object, property)
local val
local stmts = object:getAllStatements(property)
if #stmts ~= 0 then
val = stmts[1].mainsnak.datavalue.value
end
return val
end
local function getTranslations(frame, senses) -- TODO: woefully incomplete until T185313 and T199887 are resolved
if #senses == 0 then
return nil
end
local all_translations = {}
for _, sense in pairs(senses) do
local translation_set = {}
local gloss = sense:getGloss('bn')
for _, stmt in pairs(sense:getAllStatements('P5972')) do
local translation = stmt.mainsnak.datavalue.value.id
local lexeme_id = wb.lexeme.splitLexemeId(translation)
local language = getLabel(getEntity(lexeme_id):getLanguage())
table.insert(translation_set, language .. ': ' .. getLinkedLemmata(getEntity(lexeme_id)) .. '<br/>')
end
if #translation_set > 0 then
local block = frame:expandTemplate{ title = i18n['template_trans-top'], args = { gloss } }
block = block .. table.concat(translation_set, '\n') .. frame:expandTemplate{ title = i18n['template_trans-bottom'] }
table.insert(all_translations, block)
end
end
if #all_translations == 0 then
return nil
end
return '====' .. i18n['heading_translation'] .. '==== \n' .. table.concat(all_translations, '\n')
end
local createicon = function(langcode, entityID, propertyID)
langcode = langcode or ""
propertyID = propertyID or ""
local icon = " <span class='penicon autoconfirmed-show'>[["
-- " <span data-bridge-edit-flow='overwrite' class='penicon'>[[" -> enable Wikidata Bridge
.. "File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt="
.. i18n['edit_wikidata']
.. "|link=https://www.wikidata.org/entity/" .. entityID
if langcode ~= "" then icon = icon .. "?uselang=" .. langcode end
if propertyID ~= "" then icon = icon .. "#" .. propertyID end
icon = icon .. "|" .. i18n['edit_wikidata'] .. "]]</span>"
return icon
end
local function getMeanings( frame, args, current_lexeme, senses, references_seen, language_name)
if #senses == 0 then
return {createicon(i18n['content_lang_code'], current_lexeme:getId()) .. "''" .. i18n['text_category_rfdef'] .. "''" .. i18n.tocatlink(i18n['category_rfdef']), references_seen}
end
local meanings = html.create( 'ol' )
local item_label_gloss_parts = {}
local idlinkset = {}
for i, sense in pairs(senses) do
local gloss_text_parts = {}
local main_gloss_text = frame:expandTemplate{
title=i18n['template_anchor'],
args={sense:getId()}
}
local specifiers = {}
for k, property_id in ipairs({'P6084', 'P6191', 'P9488'}) do -- অবস্থান যেখানে শব্দার্থ ব্যবহৃত, যে রীতিতে শব্দার্থ ব্যবহৃত হয়, যে ক্ষেত্রে ব্যবহৃত
for _, stmt in pairs(sense:getAllStatements(property_id)) do
local stmt_value = stmt.mainsnak.datavalue.value.id
local reference_text = ''
local refs = stmt.references
if refs then
for j, reference in pairs(refs) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. frame:extensionTag('ref', got_reference[2])
end
end
local val = getLabel(stmt_value)
table.insert(specifiers, val .. reference_text)
if property_id == 'P9488' then
table.insert(item_label_gloss_parts, i18n.tocatlink(lang_code .. ':' .. val))
end
end
if #specifiers > 0 then
main_gloss_text = main_gloss_text .. "(''" .. table.concat(specifiers, "'', ''") .. "'') "
end
end
local gloss = sense:getGloss( i18n['content_lang_code'] )
if gloss then
main_gloss_text = main_gloss_text .. wrapStringInWikilinks(gloss)
if gloss:match('^প্রদত্ত%s*(%S-)%s*নাম$') then -- given names
main_gloss_text = main_gloss_text .. i18n.tocatlink(language_name .. ' ' .. i18n['category_given_names'])
end
else
local other_gloss_text = nil
local other_gloss_lang = nil
for k, stmt in pairs(sense:getAllStatements('P5137')) do -- যদি 'এই অর্থের জন্য আইটেম' মানের বাংলা লেবেল থাকে
local stmt_value = stmt.mainsnak.datavalue.value.id
local stmt_label = getLabel(stmt_value)
if stmt_label then
table.insert(item_label_gloss_parts, '[[:d:' .. stmt_value .. '|' .. stmt_label .. ']]')
end
end
if #item_label_gloss_parts > 0 then
other_gloss_text = table.concat(item_label_gloss_parts, '; ')
end
if other_gloss_text == nil then
for _, fallback_lang in ipairs(mw_lang.getFallbacksFor( i18n['content_lang_code'] )) do
if sense:getGloss( fallback_lang ) then
other_gloss_text, other_gloss_lang = sense:getGloss( fallback_lang )
end
end
if other_gloss_lang == nil then
local glosses = sense:getGlosses()
for _, gloss in pairs(glosses) do
other_gloss_text = gloss[1]
other_gloss_lang = gloss[2]
break
end
end
main_gloss_text = main_gloss_text .. other_gloss_text .. "<sup><em>" .. mw_lang.fetchLanguageName(other_gloss_lang, i18n['content_lang_code']) .. "</em></sup>"
else
main_gloss_text = main_gloss_text .. "''" .. other_gloss_text .. "''"
end
main_gloss_text = main_gloss_text .. i18n.tocatlink(i18n['category_rfdef_equivalent'])
end
local synonym = expandTemplateForProperty(frame, sense, 'P5973', i18n['template_synonym'])
if synonym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. synonym
end
local antonym = expandTemplateForProperty(frame, sense, 'P5974', i18n['template_antonym'])
if antonym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. antonym
end
local hypernym = expandTemplateForProperty(frame, sense, 'P6593', i18n['template_hypernym'])
if hypernym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. hypernym
end
if lex_cat == 'Q1084' or lex_cat == 'Q147276' then -- noun or proper noun
local demonym = expandTemplateForProperty(frame, sense, 'P6271', i18n['template_demonym-noun'])
main_gloss_text = main_gloss_text .. ' <br/> ' .. demonym
elseif lex_cat == 'Q34698' then
local demonym = expandTemplateForProperty(frame, sense, 'P6271', i18n['template_demonym-adj'])
main_gloss_text = main_gloss_text .. ' <br/> ' .. demonym
end
table.insert(gloss_text_parts, main_gloss_text .. createicon(i18n['content_lang_code'], sense:getId()))
for i, stmt in pairs(sense:getAllStatements('P8394')) do -- টিপ্পনীর উদ্ধৃতি
local gloss_quote = termSpan({stmt.mainsnak.datavalue.value.text, stmt.mainsnak.datavalue.value.language})
if stmt.references[1] then
local got_reference = getReference ( stmt.references[1].hash, stmt.references[1] )
gloss_quote = '"' .. gloss_quote .. '" ' .. got_reference[2]
end
table.insert(references_seen, stmt.references[1].hash)
table.insert(gloss_text_parts, frame:extensionTag('ref', gloss_quote))
end
for i, stmt in pairs(sense:getAllStatements('P1343')) do -- বর্ণিত উৎস
-- TODO: do away with making fake reference objects
local fake_reference = { ['snaks'] = {} }
fake_reference.snaks['P248'] = { [1] = stmt.mainsnak }
qualifiers_order = stmt['qualifiers-order']
if qualifiers_order then
for i, k in ipairs(qualifiers_order) do fake_reference.snaks[k] = stmt.qualifiers[k] end
end
fake_reference.hash = mw.hash.hashValue('sha3-512', serializeTable(fake_reference))
table.insert(references_seen, fake_reference.hash)
local got_reference = getReference(fake_reference.hash, fake_reference)
if got_reference[1] == nil then
table.insert(gloss_text_parts, frame:extensionTag('ref', got_reference[2], {name = fake_reference.hash}))
else
table.insert(gloss_text_parts, frame:extensionTag{name = 'ref', content='', args = {name = got_reference[1]}})
end
end
local first_sense_image = ''
local sense_images = sense:getAllStatements('P18')
if next(sense_images) then
first_sense_image = sense_images[1].mainsnak.datavalue.value
end
if first_sense_image ~= '' then
table.insert(gloss_text_parts, '[[চিত্র:' .. first_sense_image .. "|thumb|'''" .. getLemmata(current_lexeme) .. "'''—" .. main_gloss_text .. ']]')
end
local idlinks = getExternalLinks(sense)
if #idlinks > 0 then
local idlinktext = '<small>('
for _, idlink in pairs(idlinks) do
idlinktext = idlinktext .. idlink .. '\n'
end
idlinktext = idlinktext .. ')</small>'
table.insert(gloss_text_parts, idlinktext)
table.insert(idlinkset, idlinks)
end
local externallinks = getArticleLinks(frame, sense)
if externallinks ~= '' then
table.insert(gloss_text_parts, externallinks)
end
local new_notes = {}
local sense_keys = { sense:getId(), string.sub(sense:getId(), string.find(sense:getId(), '-')+1) }
for _, v in ipairs(sense_keys) do
if args[v] then
table.insert(new_notes, args[v])
end
end
if #new_notes > 0 then
for _, v in ipairs(new_notes) do
if i == 1 then
table.insert(gloss_text_parts, '<br/>' .. v)
else
table.insert(gloss_text_parts, v)
end
end
end
local examples, references_seen = unpack(getExamples( current_lexeme, sense:getId(), references_seen ))
local gloss_text = table.concat(gloss_text_parts, '\n')
meanings:tag('li'):wikitext(gloss_text):wikitext(examples)
end
return {meanings, references_seen, idlinkset}
end
local function getPronunciationBaseForm( lang_name, lex_cat)
local base_form = nil
-- (!) অন্য ভাষার শব্দের যদি অন্য রকম মূল ফর্ম থাকে সেগুলো এখানে নতুন if বিবৃতি দিয়ে যোগ করা যায়।
if lang_name == 'বাংলা' then
if lex_cat == 'Q1084' then -- বিশেষ্য
base_form = formWithSingleGrammaticalFeature( 'Q131105' ) -- কর্তৃকারক
elseif lex_cat == 'Q24905' then -- ক্রিয়া
base_form = formWithSingleGrammaticalFeature( 'Q1350145' ) -- ক্রিয়া বিশেষ্য
end
end
if base_form == nil then
for i, form in pairs(forms) do
base_form = form
break
end
end
return base_form
end
local function getCombines( current_lexeme, frame )
local combines = ''
local index_mappings = {}
for i, stmt in pairs(current_lexeme:getAllStatements('P5238')) do
if stmt.qualifiers and stmt.qualifiers['P1545'] then -- ক্রম
local current_index = tonumber(stmt.qualifiers['P1545'][1].datavalue.value)
index_mappings[current_index] = stmt
end
end
if #index_mappings ~= 0 then
for i, stmt in ipairs(index_mappings) do
if stmt.mainsnak.datavalue then
local part_lexeme_id = stmt.mainsnak.datavalue.value.id
local part_lexeme = getEntity(part_lexeme_id)
local current_substring = getLinkedLemmata(part_lexeme)
local part_etymology = getEtymology(part_lexeme, frame, 'partial')
if part_etymology ~= '' and part_etymology then
current_substring = current_substring .. ' (← ' .. part_etymology .. ')'
end
if combines == '' then
combines = current_substring
else -- @TODO: This shoukd use the 'affix' and 'compound' templates instead.
combines = combines .. ' + ' .. current_substring
end
end
end
end
return combines
end
function getRoots( current_lexeme )
local stmts = current_lexeme:getAllStatements('P5920')
if #stmts == 0 then return '', '', '' end
local root_lexeme = getEntity(stmts[1].mainsnak.datavalue.value.id)
return getLexemeLanguageCode(root_lexeme), '√' .. getLinkedLemmata(root_lexeme), root_lexeme:getLemma('ar')
end
function getEtymology( current_lexeme, frame, mode )
-- @TODO: Fix the etymology chains that are not possible to render
local etymology = ''
local current_combines = getCombines(current_lexeme, frame)
local root_lang, current_roots, root_str = getRoots(current_lexeme)
if mode ~= 'partial' and root_str then
frame:expandTemplate{title=i18n['template_root'], args={lang_code, root_lang, root_str}}
end
local stmts = current_lexeme:getAllStatements('P5191')
local new_etymology_string
if #stmts == 0 then
if current_roots ~= '' and current_combines ~= '' and current_roots then
return current_roots .. '<br/>(' .. current_combines .. ')'
elseif current_roots ~= '' then
if lang_code == 'ar' and mode ~= 'partial' and root_str ~= matched_lemma then
return frame:expandTemplate{title=i18n['template_ar-rootbox'], args={root_str}}
else
return current_roots
end
else
return current_combines
end
end
local origin_lexeme_string
for i, stmt in pairs(stmts) do
local origin_lexeme_dv = stmt.mainsnak.datavalue -- If this is nil, the origin lexeme is not known.
if origin_lexeme_dv then
local origin_lexeme = getEntity(origin_lexeme_dv.value.id)
local origin_lexeme_lang = getLabel(origin_lexeme:getLanguage())
local sitelink = i18n.wplink(origin_lexeme:getLanguage(), origin_lexeme_lang, wb)
if sitelink ~= '' then
origin_lexeme_string = getLinkedLemmata(origin_lexeme) .. ' (' .. sitelink .. ')'
else
origin_lexeme_string = getLinkedLemmata(origin_lexeme) .. ' (' .. origin_lexeme_lang .. ')'
end
if stmt.qualifiers and stmt.qualifiers['P5886'] then
local mode_of_derivation = stmt.qualifiers['P5886'][1].datavalue.value.id
if mode_of_derivation == 'Q1345001' then
-- @TODO: Add support for showing gender
origin_lexeme_string = frame:expandTemplate{title=i18n['template_borrowed'], args={lang_code, getLexemeLanguageCode(origin_lexeme), getLemmata(origin_lexeme), pos=getLabel(lex_cat)}} .. ' ' .. i18n['etymology_borrowing']
elseif mode_of_derivation == 'Q845079' then
origin_lexeme_string = ustring.gsub(i18n['etymology_learned_borrowing'], '$1', origin_lexeme_string)
elseif mode_of_derivation == 'Q56611986' then
origin_lexeme_string = frame:expandTemplate{title=i18n['template_inherited'], args={lang_code, getLexemeLanguageCode(origin_lexeme), getLemmata(origin_lexeme), pos=getLabel(lex_cat)}} .. ' ' .. i18n['etymology_inheritance']
elseif mode_of_derivation == 'Q189743' then
origin_lexeme_string = frame:expandTemplate{title=i18n['template_ellipsis'], args={lang_code, getLemmata(origin_lexeme)}} .. ' ' .. i18n['etymology_ellipsis']
end
end
local origin_origin = getEtymology(origin_lexeme, frame)
if origin_origin ~= '' and origin_origin then
new_etymology_string = origin_lexeme_string .. ' ← ' .. origin_origin
else
new_etymology_string = origin_lexeme_string
end
end
if etymology == '' then
etymology = new_etymology_string
elseif origin_lexeme_string and etymology then
etymology = etymology .. ' ' .. origin_lexeme_string
elseif origin_lexeme_string and etymology == nil then
etymology = origin_lexeme_string
end
end
if current_roots ~= '' and etymology and current_roots then
etymology = etymology .. ' ' .. current_roots
elseif current_roots ~= '' and etymology == nil then
etymology = current_roots
end
if current_combines ~= '' and etymology then
etymology = etymology .. '<br/>(' .. current_combines .. ')'
end
return etymology
end
local function pronunciationBlock(block, value)
return '* ' .. i18n['text_' .. block] .. ' ' .. value
end
local function getPronunciation( frame, current_lexeme, lang_name, lex_cat )
local pronunciations = {}
local base_form = getPronunciationBaseForm(lang_name, lex_cat )
if base_form then
for i, stmt in pairs(base_form:getAllStatements('P443')) do -- উচ্চারণের অডিও
local pronunciation_file = stmt.mainsnak.datavalue.value
local specifier_text = ''
local specifiers = {}
if stmt.qualifiers then
for k, property_id in ipairs({'P5237'}) do -- উচ্চারণের ধরন
local qual = stmt.qualifiers[property_id]
if qual then
for _, qual in pairs(qual) do
local stmt_value = qual.datavalue.value.id
table.insert(specifiers, getLabel(stmt_value))
end
end
end
end
if #specifiers > 0 then
specifier_text = table.concat(specifiers, "'', ''")
end
local audio_text
if specifier_text ~= '' then
audio_text = i18n['text_audio'] .. ' (' .. specifier_text .. ')'
else
audio_text = i18n['text_audio']
end
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title= i18n['template_audio'],
args = {lang_name, pronunciation_file, audio_text}
})
end
local ipa_transcription = base_form:getAllStatements('P898') -- - আধ্বব প্রতিলিপিকরণ
local iso15919_transcription = getOneStringForProperty(base_form, 'P5825') -- আইএসও ১৫৯১৯ প্রতিলিপিকরণ
local itrans = getOneStringForProperty(base_form, 'P8881') -- ITRANS
local iast = getOneStringForProperty(base_form, 'P7581') -- আইএএসটি প্রতিলিপিকরণ
local xsampa = getOneStringForProperty(base_form, 'P2859')
-- @TODO: অডিও ও প্রতিলিপিকরণ দুটোই থাকলে সেই ক্ষেত্রে একটার ঠিক পরেই আরেকটা দেখানো উচিত
if #ipa_transcription ~= 0 then
for i, stmt in pairs(ipa_transcription) do
local ipa_text = stmt.mainsnak.datavalue.value
local specifier_text = ''
local specifiers = {}
if stmt.qualifiers then
for k, property_id in ipairs({'P5237'}) do -- উচ্চারণের ধরন
for l, qual in ipairs(stmt.qualifiers[property_id]) do
table.insert(specifiers, getLabel( qual.datavalue.value.id ))
end
end
end
if #specifiers > 0 then
specifier_text = "(''" .. table.concat(specifiers, "'', ''") .. "'') "
end
local syllable_count
if lang_code == 'tr' then
syllable_count = i18n['text_syllable_count'] .. ' ' .. callWikifunctionsFunction('Z10029|' .. ipa_text, frame)
else
syllable_count = i18n['text_syllable_count'] .. ' ' .. callWikifunctionsFunction('Z30837|' .. ipa_text, frame)
end
table.insert(pronunciations, '* ' .. specifier_text .. frame:expandTemplate{
title= i18n['template_ipa'],
args = {lang_name, ipa_text}
} .. '\n* ' .. syllable_count)
end
-- The following checks are ordered based on which one is expected to be true in a higher number of cases.
elseif lang_name == 'বাংলা' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='bn-IPA',
})
elseif lang_name == 'আরবি' then
local lemma = current_lexeme:getLemma('ar')
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='ar-IPA',
args={lemma}
})
elseif lang_name == 'ফালা' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='fax-pron',
})
elseif lang_code == 'fi' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='fi-IPA',
})
elseif lang_code == 'ko' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='ko-IPA',
})
end
if iso15919_transcription then
table.insert(pronunciations, pronunciationBlock('iso15919', iso15919_transcription))
end
if itrans then
table.insert(pronunciations, pronunciationBlock('itrans', itrans))
end
if iast then
table.insert(pronunciations, pronunciationBlock('iast', iast))
end
if xsampa then
table.insert(pronunciations, pronunciationBlock('xsampa', xsampa))
end
end -- {{আধ্বব|en|/ˈɪntəvjuː/}}
return table.concat(pronunciations, '\n')
end
local function getAlternativeSpellings( current_lexeme )
local alt_spellings = {}
for i, stmt in pairs(current_lexeme:getAllStatements('P11577')) do -- বিকল্প বানান
if stmt.mainsnak.datavalue then
table.insert(alt_spellings, '* ' .. getLinkedLemmata(getEntity(stmt.mainsnak.datavalue.value.id)))
end
end
return table.concat(alt_spellings, '\n')
end
local function heading_level(text, level)
local heading_delimiter = string.rep('=', level)
return heading_delimiter .. ' ' .. text .. ' ' .. heading_delimiter
end
function get_any_notes(sections, args, keys)
local notes = {}
for i, v in ipairs(keys) do
if args[v] then
table.insert(notes, args[v])
end
end
return notes
end
function add_specific_notes(sections, notes)
for i, v in ipairs(notes) do
table.insert(sections, v)
end
end
local function add_any_notes(sections, args, keys)
for i, v in ipairs(keys) do
if args[v] then
table.insert(sections, args[v])
end
end
end
local function getMatchingLemmaForPageTitle(lexeme, title)
local lemmas = lexeme:getLemmas()
local matched_lemma
for _, lemma_entry in ipairs(lemmas) do
local lemma = lemma_entry[1]
if lemma == title then
matched_lemma = lemma
break
end
end
if matched_lemma == nil and lang_code == 'ar' then -- Arabic lemmas do not match the title of the entry because those are written with different characters stripped out on Wiktionary
matched_lemma = lexeme:getLemma('ar')
end
return matched_lemma
end
local function buildLanguageAgnosticInflectionTable()
local has_image = false
local form_images = {}
for i, form in ipairs(forms) do
local form_image = form:getAllStatements('P7407')
if next(form_image) then
form_images[i] = form_image[1].mainsnak.datavalue.value
has_image = true
end
end
local table_class = "wikitable mw-collapsible sortable"
if not has_image then
table_class = table_class .. " mw-collapsed"
end
local text = "{| class='" .. table_class .. "' style='border:solid 1px rgb(80%,80%,100%); text-align:center;'\n"
text = text .. "|+ " .. i18n['heading_inflection_table'] .. "\n"
text = text .. "|- \n"
text = text .. "! " .. i18n['heading_form'] .. " !! " .. i18n['heading_grammatical_features']
if has_image then
text = text .. " !! " .. (i18n['heading_image'])
end
text = text .. " \n"
for i, form in ipairs(forms) do
local rep = form:getRepresentations()
local feat = form:getGrammaticalFeatures()
local rep_text = ""
for j, r in pairs(rep) do
if rep_text == "" then
rep_text = r[1]
else
rep_text = rep_text .. " / " .. r[1]
end
end
local feat_text = ""
if feat then
for j, f in ipairs(feat) do
local label = getLabel(f) or f
if feat_text == "" then
feat_text = label
else
feat_text = feat_text .. ", " .. label
end
end
end
text = text .. "|-\n"
text = text .. "| " .. (rep_text ~= "" and rep_text or "—")
text = text .. " || " .. (feat_text ~= "" and feat_text or "—")
if has_image then
local image_cell = "—"
if form_images[i] then
image_cell = "[[চিত্র:" .. form_images[i] .. "|50px]]"
end
text = text .. " || " .. image_cell
end
text = text .. "\n"
end
text = text .. "|}"
return text
end
function p.all( frame )
local args = getArgs(frame)
local lexeme_id = args[1]
local current_lexeme = getEntity(lexeme_id)
local current_language = current_lexeme:getLanguage()
local senses = current_lexeme:getSenses()
local add_heading = true
forms = current_lexeme:getForms()
if args[2] then
local val = mw.text.trim(tostring(args[2]))
if val == "false" or val == "0" or val == "না" then
add_heading = false
end
end
local references_seen = {}
local sections = {}
local title = mw.title.getCurrentTitle().text
local lang_category = getLanguageForCategories(current_language, title)
local lang_name = getLabel(lang_category)
if add_heading == true then
local lang_heading = "== " .. lang_name .. " =="
table.insert(sections, lang_heading)
end
matched_lemma = getMatchingLemmaForPageTitle(current_lexeme, title)
lex_cat = current_lexeme:getLexicalCategory()
lang_code = getLexemeLanguageCode(current_lexeme)
local cat = i18n.lang_category(getLabel(lex_cat), lang_name)
local lex_cat_template
if cat then
table.insert(sections, '===' .. getLabel(lex_cat) .. cat .. frame:expandTemplate{
title = i18n['template_anchor'],
args = { lexeme_id }
} .. '===')
table.insert(sections, frame:expandTemplate{
title= i18n['template_lexeme'],
args = {lexeme_id}
})
add_any_notes(sections, args, i18n['manual_category'])
local etymology = getEtymology( current_lexeme, frame )
if etymology ~= '' and etymology then
table.insert(sections, heading_level(i18n['heading_etymology'], 4))
table.insert(sections, tostring(etymology))
end
add_any_notes(sections, args, i18n['manual_etymology'])
local pronunciation = getPronunciation( frame, current_lexeme, lang_name, lex_cat )
if pronunciation ~= '' then
table.insert(sections, heading_level(i18n['heading_pronunciation'], 4))
table.insert(sections, tostring(pronunciation))
end
add_any_notes(sections, args, i18n['manual_pronunciation'])
local alternative_spellings = getAlternativeSpellings( current_lexeme )
if alternative_spellings ~= '' then
table.insert(sections, heading_level(i18n['heading_alternative_spellings'], 4))
table.insert(sections, alternative_spellings)
end
if lang_code and lang_code ~= 'ksy' and lang_code ~= 'rkt' then -- Skip for Kharia Thar, Rangpuri
if lex_cat == 'Q34698' then -- বিশেষণ
if lang_code == 'en' or lang_code == 'bn' then
if #forms <= 1 then
lex_cat_template = frame:expandTemplate{title= lang_code .. '-বিশেষণ'}
end
else
lex_cat_template = safeExpand(frame, lang_code .. '-adj')
if not lex_cat_template then
lex_cat_template = safeExpand(frame, lang_code .. '-বিশেষণ')
end
end
elseif lex_cat == 'Q1084' then -- @TODO: Also check for plural forms
local gender
local stmts = current_lexeme:getAllStatements('P5185') -- ব্যাকরণগত লিঙ্গ
if #stmts ~= 0 then
if #stmts == 1 then
local gender_qid = stmts[1].mainsnak.datavalue.value.id
if gender_qid == 'Q499327' then
gender = 'm'
elseif gender_qid == 'Q1775415' then
gender = 'f'
elseif gender_qid == 'Q1775461' then
gender = 'n'
elseif gender_qid == 'Q1305037' then
gender = 'c'
end
end
else
for i, stmt in pairs(stmts) do
local qid = stmts[i].mainsnak.datavalue.value.id
if qid == 'Q499327' then
gender = gender .. 'm'
elseif qid == 'Q1775415' then
gender = gender .. 'f'
end
end
end
-- The following checks are ordered based on which one is expected to be true in a higher number of cases.
if current_language == 'Q13955' then
if matched_lemma then
lex_cat_template = safeExpand(frame, {title='ar-noun', args={matched_lemma,gender}})
else
lex_cat_template = frame:expandTemplate{title='ar-noun', args={nil,gender}}
end
elseif current_language == 'Q29919' then
lex_cat_template = frame:expandTemplate{title='arz-noun', args={g=gender}}
elseif current_language == 'Q397' then
if matched_lemma then
lex_cat_template = frame:expandTemplate{title='la-noun', args={matched_lemma,g=gender}}
end
elseif current_language == 'Q11059' then
lex_cat_template = frame:expandTemplate{title='sa-noun', args={g=gender}}
elseif current_language ~= 'Q1860' then -- These templates require the gender to be passed as the 1st argument.
lex_cat_template = safeExpand(frame, lang_code .. i18n['noun_template_suffix'], {gender})
if not lex_cat_template then
lex_cat_template = safeExpand(frame, lang_code .. i18n['noun_template_suffix_fallback'], {gender})
end
end
end
end
-- elseif lex_cat == 'Q147276' then
-- lex_cat_template = safeExpand(frame, lang_code .. '-proper noun', {gender})
-- if not lex_cat_template then
-- lex_cat_template = safeExpand(frame, lang_code .. '-নামবাচক বিশেষ্য', {gender})
-- end
end
if lex_cat_template then
table.insert(sections, lex_cat_template)
else
if matched_lemma then
table.insert(sections, heading_level(matched_lemma, 4))
else
table.insert(sections, i18n.tocatlink(i18n['category_no_matching_lemma']))
end
end
local meanings, references_seen, sense_extlinks = unpack(getMeanings( frame, args, current_lexeme, senses, references_seen, lang_name))
table.insert(sections, tostring(meanings))
add_any_notes(sections, args, i18n['manual_meaning'])
local instance_of = current_lexeme:getAllStatements('P31') -- সত্ত্বার ধরন
if #instance_of ~= 0 then
local instance_of_entity = instance_of[1].mainsnak.datavalue.value.id
if instance_of_entity == 'Q40437546' or instance_of_entity == 'Q120831827' or instance_of_entity == 'Q120717979' or instance_of_entity == 'Q124476844' then -- @TODO: generalise this so all types of roots are shown
table.insert(sections, i18n['text_instance_of'] .. ' ' .. getLabel(instance_of_entity))
elseif instance_of_entity == 'Q376431' then -- বর্ণের নাম
table.insert(sections, i18n.tocatlink(lang_code .. ':রং'))
end
end
local translations = getTranslations(frame, senses)
if translations then
table.insert(sections, translations)
end
-- (!) বিশেষ ভাষার বিভক্তির সারণি যদি থাকে সেগুলো এখানে নতুন if বিবৃতি যোগ করা যায়।
if next(forms) then
if current_language == 'Q9610' then -- বাংলা
if lex_cat == 'Q24905' then
local conjTable = require('মডিউল:আভিধানিক উপাত্ত/Q9610').getConjTable(frame, forms)
table.insert(sections, conjTable)
elseif lex_cat == 'Q1084' then
--table.insert(sections, callWikifunctionsFunction('Z33243|' .. lexeme_id .. '|', frame))
table.insert(sections, buildLanguageAgnosticInflectionTable())
elseif lex_cat == 'Q34698' then
if #forms > 1 then
table.insert(sections, buildLanguageAgnosticInflectionTable())
end
end
--elseif current_language == 'Q13955' then -- আরবি
-- if lex_cat == 'Q1084' then
-- table.insert(sections, frame:expandTemplate{title='ar-decl-noun', args={lemma}})
-- end
elseif current_language == 'Q188' then -- জার্মান
if lex_cat == 'Q1084' then
table.insert(sections, callWikifunctionsFunction('Z28602|' .. lexeme_id .. '|', frame))
end
else
if #forms > 1 then
table.insert(sections, buildLanguageAgnosticInflectionTable())
end
end
end
if lex_cat == 'Q134830' then
table.insert(sections, frame:expandTemplate{title='prefixsee', args={lang_code}})
elseif lex_cat == 'Q102047' then
table.insert(sections, frame:expandTemplate{title='suffixsee', args={lang_code}})
-- elseif lex_cat == 'Q111029' then
-- table.insert(sections, frame:expandTemplate{title='rootsee', args={'+', lang_code, matched_lemma}})
end
local reference_notes = get_any_notes(sections, args, i18n['manual_reference'])
if #references_seen > 0 or #reference_notes > 0 then
table.insert(sections, heading_level(i18n['heading_references'], 4))
table.insert(sections, frame:extensionTag('references'))
add_specific_notes(sections, reference_notes)
end
local external_link_table = getExternalLinks ( current_lexeme )
if #external_link_table > 0 then
local external_links = '* ' .. table.concat(external_link_table, '\n* ')
table.insert(sections, heading_level(i18n['heading_external_links'], 4))
table.insert(sections, external_links)
end
add_any_notes(sections, args, i18n['manual_external_link'])
if #references_seen == 0 and #reference_notes == 0 and sense_extlinks and #sense_extlinks == 0 and #external_link_table == 0 and #get_any_notes(sections, args, i18n['manual_external_link']) == 0 then
table.insert(sections, i18n.rfref_category(lang_name))
end
return table.concat(sections,"\n\n")
end
return p
6u30zmei11nk3a3vvufdiub711xtlv1
509627
509626
2026-06-03T10:22:59Z
Redmin
6857
509627
Scribunto
text/plain
local p = {}
local i18n = require('মডিউল:আভিধানিক উপাত্ত/i18n')
local references = require('মডিউল:উইকিউপাত্ত তথ্যসূত্র বিন্যাসকরণ').format
local getArgs = require('Module:Arguments').getArgs
local wb = mw.wikibase
local ustring = mw.ustring
local html = mw.html
local mw_lang = mw.language
local entity_cache = {}
local reference_cache = {}
local forms
local lang_code
local lex_cat
local matched_lemma
local function wrapStringInWikilinks(str)
local exceptions = i18n.nolinks
local result = str:gsub('(%S+)', function(token)
local word, trailing_char = token:match('^(.-)([;,]*)$')
local wrapped = word:gsub('[^(-/]+', function(part)
if exceptions[part] then
return part
else
return '[[' .. part .. '#' .. i18n['content_lang_name'] .. '|' .. part .. ']]'
end
end)
return wrapped .. trailing_char
end)
return result
end
local function serializeTable(val, name, skipnewlines, depth) -- https://stackoverflow.com/a/6081639
skipnewlines = skipnewlines or false
depth = depth or 0
local tmp = string.rep(" ", depth)
if name then tmp = tmp .. name .. " = " end
if type(val) == "table" then
tmp = tmp .. "{" .. (not skipnewlines and "\n" or "")
for k, v in pairs(val) do
tmp = tmp .. serializeTable(v, k, skipnewlines, depth + 1) .. "," .. (not skipnewlines and "\n" or "")
end
tmp = tmp .. string.rep(" ", depth) .. "}"
elseif type(val) == "number" then
tmp = tmp .. tostring(val)
elseif type(val) == "string" then
tmp = tmp .. string.format("%q", val)
elseif type(val) == "boolean" then
tmp = tmp .. (val and "true" or "false")
else
tmp = tmp .. "\"[inserializeable datatype:" .. type(val) .. "]\""
end
return tmp
end
-- Use this to safely expand templates when you are not sure that they exist.
local function safeExpand(frame, title, args)
local _, result = pcall(function()
return frame:expandTemplate{ title = title, args = args }
end)
if result:find('does not exist') then -- expandTemplate{} doesn't seem to throw any error that can be handled with pcall() so string search is the only viable option.
return nil
end
return result
end
-- Use this function to get the label of an item even if that item does not have any label in the wiki's content language or English.
local function getLabel(id)
if id == 'Q11051hi' then
return 'হিন্দি'
elseif id == 'Q11051ur' then
return 'উর্দু'
elseif id == 'Q56356571fa' then
return 'নয়া ফার্সি'
elseif id == 'Q56356571tg' then
return 'তাজিক'
elseif id == 'Q58635pa' or id == 'Q58635pnb' then
return 'পাঞ্জাবি'
end
local label = wb.getLabel(id)
if label then
return label
end
local labels = wb.getEntity(id).labels
if not labels then
return id
end
for _, v in pairs(labels) do
if v and v.value then
return v.value
end
end
end
local function getReference( id, reference )
local out_id = nil
local url_value
if reference_cache[id] == nil then
local ref_text = references(reference, wb, mw_lang, i18n['content_lang_code'], i18n['wikipedia'])
if reference.snaks then
if reference.snaks['P248'] then
for _, snak in pairs(reference.snaks['P248']) do
if snak.datavalue and snak.datavalue.value.id == 'Q428' then -- কুরআন
ref_text = ustring.gsub(ref_text, 'নামক অনুচ্ছেদ', 'নং আয়াত')
break
end
end
end
if reference.snaks['P854'] then
local snak = reference.snaks['P854'][1]
if snak.datavalue then
url_value = snak.datavalue.value
end
end
end
if url_value then
ref_text = ref_text .. ', [' .. url_value .. ' সংযোগ]'
end
reference_cache[id] = ref_text
else
out_id = id
end
return {out_id, reference_cache[id]}
end
local function getEntity( id )
if entity_cache[id] == nil then
entity_cache[id] = wb.getEntity(id)
end
return entity_cache[id] ~= false and entity_cache[id] or nil
end
local function getLexemeLanguageCode(current_lexeme)
local lang_item_id = current_lexeme:getLanguage()
if lang_item_id == nil then
return nil
end
local lang_entity = getEntity(lang_item_id)
if lang_entity == nil then
return nil
end
for i, statement_property in ipairs({'P305','P424', 'P220'}) do -- আইইটিএফ ভাষা ট্যাগ, উইকিমিডিয়া ভাষা কোড, আইএসও ৬৩৯-৩
local statements = lang_entity:getBestStatements(statement_property)
if statements[1] then
return statements[1].mainsnak.datavalue.value
end
end
return nil
end
-- Return the first form of the lexeme which has exactly the given grammatical feature.
local function formWithSingleGrammaticalFeature( item_id )
for i = 1, #forms do
local grammaticalFeatures = forms[i]:getGrammaticalFeatures()
if #grammaticalFeatures == 1 and grammaticalFeatures[1] == item_id then
return forms[i]
end
end
return nil
end
local function getArticleLinkTemplate(frame, stmt_value)
local template = ''
local sitelink = getEntity(stmt_value):getSitelink(i18n['wikipedia'])
if sitelink then
template = frame:expandTemplate{
title=i18n['template_wikipedia'],
args={sitelink}
}
end
return template
end
local function getArticleLinks (frame, sense )
local article_links = ''
for i, stmt in pairs(sense:getAllStatements('P5137')) do -- এই অর্থের জন্য আইটেম
article_links = article_links .. getArticleLinkTemplate(frame, stmt.mainsnak.datavalue.value.id)
end
for i, stmt in pairs(sense:getAllStatements('P9970')) do -- এই অর্থের জন্য বিধেয়
article_links = article_links .. getArticleLinkTemplate(frame, stmt.mainsnak.datavalue.value.id)
end
return article_links
end
-- @TODO: Generalise
local function expandTemplateForProperty(frame, object, property, template)
local lemmas = {}
local n = 0
for _, stmt in pairs(object:getAllStatements(property)) do
local lex = wb.lexeme.splitLexemeId(stmt.mainsnak.datavalue.value.id)
if lex then
lex = getEntity(lex)
n = n + 1
lemmas[n] = lex:getLemma(lang_code)
end
end
if not lang_code or n == 0 then
return ''
end
-- Build args: first lang_code, then lemmas
local args = {lang_code}
for i = 1, n do
args[#args + 1] = lemmas[i]
end
return frame:expandTemplate{
title = template,
args = args
}
end
local function getExternalLinks( entity ) -- T418639
local external_links = {}
if entity.claims == nil then return external_links end
local formatter_urls = require('মডিউল:আভিধানিক উপাত্ত/urls').formatter_urls
for property_id, statements in pairs(entity.claims) do
local formatter_url = formatter_urls[property_id]
if formatter_url then
local property_source = wb.getBestStatements(property_id, 'P9073')
local source_name
if next(property_source) then
source_name = getLabel(property_source[1].mainsnak.datavalue.value.id)
or property_source[1].mainsnak.datavalue.value.id
else
source_name = getLabel(property_id) or property_id
end
for i = 1, #statements do
local stmt = statements[i]
if stmt.mainsnak.datavalue then
local formatted_link = ustring.gsub(
ustring.gsub(formatter_url, '$1', ustring.gsub(stmt.mainsnak.datavalue.value, '%%', '%%%%')),
' ', '+'
)
table.insert(external_links,
'[' .. formatted_link .. ' ' .. source_name .. ']')
end
end
end
end
return external_links
end
p.getExternalLinks = getExternalLinks -- রেখে দিন যাতে ডিবাগিং সম্ভব হয়
local function termSpan( term )
local text = term[1]
local lang = term[2]
local dir = mw_lang.new( lang ):getDir()
local span = html.create( 'span' )
span:attr( 'lang', lang )
:attr( 'dir', dir )
:wikitext( text )
return tostring( span )
end
local function termLink( term, lang_qid )
local text = term[1]
local lang = term[2]
local dir = mw_lang.new( lang ):getDir()
local span = html.create( 'span' )
span:attr( 'lang', lang )
:attr( 'dir', dir )
:wikitext( '[[' .. text .. '#' .. getLabel(lang_qid) .. '|' .. text .. ']]' )
return tostring( span )
end
local function getLemmata( current_lexeme )
local lemma_string = ''
for i, rep in pairs(current_lexeme:getLemmas()) do
if lemma_string == '' then
lemma_string = termSpan(rep)
else
lemma_string = lemma_string .. '/' .. termSpan(rep)
end
end
return lemma_string
end
local function getLinkedLemmata( current_lexeme )
local lemma_string = ''
for i, rep in pairs(current_lexeme:getLemmas()) do
if lemma_string == '' then
lemma_string = termLink(rep, current_lexeme:getLanguage())
else
lemma_string = lemma_string .. '/' .. termLink(rep, current_lexeme:getLanguage())
end
end
return lemma_string
end
local function getExamples( current_lexeme, sense_id, references_seen )
local examples = html.create('dl')
local example_text, example_lang, example_form, example_str
for i, stmt in pairs(current_lexeme:getAllStatements('P5831')) do -- ব্যবহারের উদাহরণ
if stmt.qualifiers and stmt.qualifiers['P6072'] and stmt.qualifiers['P6072'][1].datavalue.value.id == sense_id then -- বিষয়ে লেক্সিমের অর্থ
example_text = ustring.gsub(stmt.mainsnak.datavalue.value.text, ' / ','<br/>')
example_lang = stmt.mainsnak.datavalue.value.language
local example_form_strs = {}
if stmt.qualifiers['P1810'] then
table.insert(example_form_strs, stmt.qualifiers['P1810'][1].datavalue.value)
elseif stmt.qualifiers['P5830'] then
example_form = getEntity(stmt.qualifiers['P5830'][1].datavalue.value.id) -- বিষয়ে লেক্সিমের রূপ
for _, rep in pairs(example_form:getRepresentations()) do
table.insert(example_form_strs, rep[1])
end
end
for i, example_form_str in pairs(example_form_strs) do
new_example_text = ustring.gsub(example_text, example_form_str, "'''" .. example_form_str .. "'''")
if new_example_text ~= example_text then
example_str = termSpan({new_example_text, example_lang})
break
end
new_example_text = example_text
end
if example_str == nil then
example_str = termSpan({example_text, example_lang})
end
local reference_text = ''
if stmt.references then
for j, reference in pairs(stmt.references) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. got_reference[2]
end
end
if example_str then
examples:tag('dd'):wikitext("''" .. example_str .. "''")
if reference_text ~= '' then
examples:done():tag('dd'):css('text-indent', '2em'):wikitext(reference_text)
end
end
end
end
for i, stmt in pairs(wb.getAllStatements(sense_id, 'P5831')) do -- ব্যবহারের উদাহরণ
example_text = ustring.gsub(stmt.mainsnak.datavalue.value.text, ' / ','<br/>')
example_lang = stmt.mainsnak.datavalue.value.language
local example_form_str = nil
if stmt.qualifers then
example_form = getEntity(stmt.qualifiers['P5830'][1].datavalue.value.id) -- বিষয়ে লেক্সিমের রূপ
if stmt.qualifiers['P1810'] then
example_form_str = stmt.qualifiers['P1810'][1].datavalue.value
end
end
if example_form and example_form_str == nil then
example_form_str = example_form:getRepresentation(i18n['content_lang_code'])
end
if example_form and example_form_str == nil then
example_form_str = example_form:getRepresentations()[1][1]
end
if example_form_str then
example_text = ustring.gsub(example_text, example_form_str, "'''" .. example_form_str .. "'''")
end
example_str = termSpan({example_text, example_lang})
local reference_text = ''
if stmt.references then
for j, reference in pairs(stmt.references) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. got_reference[2]
end
end
if example_str then
examples:tag('dd'):wikitext("''" .. example_str .. "''")
if reference_text ~= '' then
examples:done():tag('dd'):css('text-indent', '2em'):wikitext(reference_text)
end
end
end
return { tostring(examples) , references_seen }
end
-- This calls frame:preprocess() instead of :callParserFunction() because the latter does not work for Wikifunctions function calls yet (see https://www.wikifunctions.org/wiki/Wikifunctions:Embedded_function_calls).
local function callWikifunctionsFunction(args, frame)
return frame:preprocess('{{#function:' .. args .. '}}')
end
local function checkTitleCodePointInRange(title, start_point, end_point)
return ustring.find( title, '[' ..ustring.char(start_point) .. '-' .. ustring.char(end_point) .. ']' )
end
local function getLanguageForCategories( lang_id, current_page_title )
-- বিশেষ ভাষার জন্য
if lang_id == 'Q11051' then -- হিন্দি/উর্দু
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- উর্দু
lang_id = 'Q11051ur'
elseif checkTitleCodePointInRange(current_page_title, 0x0900, 0x097f) then -- হিন্দি
lang_id = 'Q11051hi'
end
elseif lang_id == 'Q58635' then -- পাঞ্জাবি
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- শাহমুখী
lang_id = 'Q58635pnb'
elseif checkTitleCodePointInRange(current_page_title, 0x0a00, 0x0a7f) then -- গুরুমুখী
lang_id = 'Q58635pa'
end
elseif lang_id == 'Q56356571' then -- নয়া ফার্সি ভাষা
if checkTitleCodePointInRange(current_page_title, 0x0600, 0x06ff) then -- ফার্সি (ইরান/আফগানিস্তান)
lang_id = 'Q56356571fa'
elseif checkTitleCodePointInRange(current_page_title, 0x0400, 0x04ff) then -- তাজিক
lang_id = 'Q56356571tg'
end
end
return lang_id
end
local function getOneStringForProperty(object, property)
local val
local stmts = object:getAllStatements(property)
if #stmts ~= 0 then
val = stmts[1].mainsnak.datavalue.value
end
return val
end
local function getTranslations(frame, senses) -- TODO: woefully incomplete until T185313 and T199887 are resolved
if #senses == 0 then
return nil
end
local all_translations = {}
for _, sense in pairs(senses) do
local translation_set = {}
local gloss = sense:getGloss('bn')
for _, stmt in pairs(sense:getAllStatements('P5972')) do
local translation = stmt.mainsnak.datavalue.value.id
local lexeme_id = wb.lexeme.splitLexemeId(translation)
local language = getLabel(getEntity(lexeme_id):getLanguage())
table.insert(translation_set, language .. ': ' .. getLinkedLemmata(getEntity(lexeme_id)) .. '<br/>')
end
if #translation_set > 0 then
local block = frame:expandTemplate{ title = i18n['template_trans-top'], args = { gloss } }
block = block .. table.concat(translation_set, '\n') .. frame:expandTemplate{ title = i18n['template_trans-bottom'] }
table.insert(all_translations, block)
end
end
if #all_translations == 0 then
return nil
end
return '====' .. i18n['heading_translation'] .. '==== \n' .. table.concat(all_translations, '\n')
end
local createicon = function(langcode, entityID, propertyID)
langcode = langcode or ""
propertyID = propertyID or ""
local icon = " <span class='penicon autoconfirmed-show'>[["
-- " <span data-bridge-edit-flow='overwrite' class='penicon'>[[" -> enable Wikidata Bridge
.. "File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt="
.. i18n['edit_wikidata']
.. "|link=https://www.wikidata.org/entity/" .. entityID
if langcode ~= "" then icon = icon .. "?uselang=" .. langcode end
if propertyID ~= "" then icon = icon .. "#" .. propertyID end
icon = icon .. "|" .. i18n['edit_wikidata'] .. "]]</span>"
return icon
end
local function getMeanings( frame, args, current_lexeme, senses, references_seen, language_name)
if #senses == 0 then
return {createicon(i18n['content_lang_code'], current_lexeme:getId()) .. "''" .. i18n['text_category_rfdef'] .. "''" .. i18n.tocatlink(i18n['category_rfdef']), references_seen}
end
local meanings = html.create( 'ol' )
local item_label_gloss_parts = {}
local idlinkset = {}
for i, sense in pairs(senses) do
local gloss_text_parts = {}
local main_gloss_text = frame:expandTemplate{
title=i18n['template_anchor'],
args={sense:getId()}
}
local specifiers = {}
for k, property_id in ipairs({'P6084', 'P6191', 'P9488'}) do -- অবস্থান যেখানে শব্দার্থ ব্যবহৃত, যে রীতিতে শব্দার্থ ব্যবহৃত হয়, যে ক্ষেত্রে ব্যবহৃত
for _, stmt in pairs(sense:getAllStatements(property_id)) do
local stmt_value = stmt.mainsnak.datavalue.value.id
local reference_text = ''
local refs = stmt.references
if refs then
for j, reference in pairs(refs) do
table.insert(references_seen, reference.hash)
local got_reference = getReference(reference.hash, reference)
reference_text = reference_text .. '\n\n' .. frame:extensionTag('ref', got_reference[2])
end
end
local val = getLabel(stmt_value)
table.insert(specifiers, val .. reference_text)
if property_id == 'P9488' then
table.insert(item_label_gloss_parts, i18n.tocatlink(lang_code .. ':' .. val))
end
end
if #specifiers > 0 then
main_gloss_text = main_gloss_text .. "(''" .. table.concat(specifiers, "'', ''") .. "'') "
end
end
local gloss = sense:getGloss( i18n['content_lang_code'] )
if gloss then
main_gloss_text = main_gloss_text .. wrapStringInWikilinks(gloss)
if gloss:match('^প্রদত্ত%s*(%S-)%s*নাম$') then -- given names
main_gloss_text = main_gloss_text .. i18n.tocatlink(language_name .. ' ' .. i18n['category_given_names'])
end
else
local other_gloss_text = nil
local other_gloss_lang = nil
for k, stmt in pairs(sense:getAllStatements('P5137')) do -- যদি 'এই অর্থের জন্য আইটেম' মানের বাংলা লেবেল থাকে
local stmt_value = stmt.mainsnak.datavalue.value.id
local stmt_label = getLabel(stmt_value)
if stmt_label then
table.insert(item_label_gloss_parts, '[[:d:' .. stmt_value .. '|' .. stmt_label .. ']]')
end
end
if #item_label_gloss_parts > 0 then
other_gloss_text = table.concat(item_label_gloss_parts, '; ')
end
if other_gloss_text == nil then
for _, fallback_lang in ipairs(mw_lang.getFallbacksFor( i18n['content_lang_code'] )) do
if sense:getGloss( fallback_lang ) then
other_gloss_text, other_gloss_lang = sense:getGloss( fallback_lang )
end
end
if other_gloss_lang == nil then
local glosses = sense:getGlosses()
for _, gloss in pairs(glosses) do
other_gloss_text = gloss[1]
other_gloss_lang = gloss[2]
break
end
end
main_gloss_text = main_gloss_text .. other_gloss_text .. "<sup><em>" .. mw_lang.fetchLanguageName(other_gloss_lang, i18n['content_lang_code']) .. "</em></sup>"
else
main_gloss_text = main_gloss_text .. "''" .. other_gloss_text .. "''"
end
main_gloss_text = main_gloss_text .. i18n.tocatlink(i18n['category_rfdef_equivalent'])
end
local synonym = expandTemplateForProperty(frame, sense, 'P5973', i18n['template_synonym'])
if synonym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. synonym
end
local antonym = expandTemplateForProperty(frame, sense, 'P5974', i18n['template_antonym'])
if antonym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. antonym
end
local hypernym = expandTemplateForProperty(frame, sense, 'P6593', i18n['template_hypernym'])
if hypernym ~= '' then
main_gloss_text = main_gloss_text .. ' <br/> ' .. hypernym
end
if lex_cat == 'Q1084' or lex_cat == 'Q147276' then -- noun or proper noun
local demonym = expandTemplateForProperty(frame, sense, 'P6271', i18n['template_demonym-noun'])
main_gloss_text = main_gloss_text .. ' <br/> ' .. demonym
elseif lex_cat == 'Q34698' then
local demonym = expandTemplateForProperty(frame, sense, 'P6271', i18n['template_demonym-adj'])
main_gloss_text = main_gloss_text .. ' <br/> ' .. demonym
end
table.insert(gloss_text_parts, main_gloss_text .. createicon(i18n['content_lang_code'], sense:getId()))
for i, stmt in pairs(sense:getAllStatements('P8394')) do -- টিপ্পনীর উদ্ধৃতি
local gloss_quote = termSpan({stmt.mainsnak.datavalue.value.text, stmt.mainsnak.datavalue.value.language})
if stmt.references[1] then
local got_reference = getReference ( stmt.references[1].hash, stmt.references[1] )
gloss_quote = '"' .. gloss_quote .. '" ' .. got_reference[2]
end
table.insert(references_seen, stmt.references[1].hash)
table.insert(gloss_text_parts, frame:extensionTag('ref', gloss_quote))
end
for i, stmt in pairs(sense:getAllStatements('P1343')) do -- বর্ণিত উৎস
-- TODO: do away with making fake reference objects
local fake_reference = { ['snaks'] = {} }
fake_reference.snaks['P248'] = { [1] = stmt.mainsnak }
qualifiers_order = stmt['qualifiers-order']
if qualifiers_order then
for i, k in ipairs(qualifiers_order) do fake_reference.snaks[k] = stmt.qualifiers[k] end
end
fake_reference.hash = mw.hash.hashValue('sha3-512', serializeTable(fake_reference))
table.insert(references_seen, fake_reference.hash)
local got_reference = getReference(fake_reference.hash, fake_reference)
if got_reference[1] == nil then
table.insert(gloss_text_parts, frame:extensionTag('ref', got_reference[2], {name = fake_reference.hash}))
else
table.insert(gloss_text_parts, frame:extensionTag{name = 'ref', content='', args = {name = got_reference[1]}})
end
end
local first_sense_image = ''
local sense_images = sense:getAllStatements('P18')
if next(sense_images) then
first_sense_image = sense_images[1].mainsnak.datavalue.value
end
if first_sense_image ~= '' then
table.insert(gloss_text_parts, '[[চিত্র:' .. first_sense_image .. "|thumb|'''" .. getLemmata(current_lexeme) .. "'''—" .. main_gloss_text .. ']]')
end
local idlinks = getExternalLinks(sense)
if #idlinks > 0 then
local idlinktext = '<small>('
for _, idlink in pairs(idlinks) do
idlinktext = idlinktext .. idlink .. '\n'
end
idlinktext = idlinktext .. ')</small>'
table.insert(gloss_text_parts, idlinktext)
table.insert(idlinkset, idlinks)
end
local externallinks = getArticleLinks(frame, sense)
if externallinks ~= '' then
table.insert(gloss_text_parts, externallinks)
end
local new_notes = {}
local sense_keys = { sense:getId(), string.sub(sense:getId(), string.find(sense:getId(), '-')+1) }
for _, v in ipairs(sense_keys) do
if args[v] then
table.insert(new_notes, args[v])
end
end
if #new_notes > 0 then
for _, v in ipairs(new_notes) do
if i == 1 then
table.insert(gloss_text_parts, '<br/>' .. v)
else
table.insert(gloss_text_parts, v)
end
end
end
local examples, references_seen = unpack(getExamples( current_lexeme, sense:getId(), references_seen ))
local gloss_text = table.concat(gloss_text_parts, '\n')
meanings:tag('li'):wikitext(gloss_text):wikitext(examples)
end
return {meanings, references_seen, idlinkset}
end
local function getPronunciationBaseForm( lang_name, lex_cat)
local base_form = nil
-- (!) অন্য ভাষার শব্দের যদি অন্য রকম মূল ফর্ম থাকে সেগুলো এখানে নতুন if বিবৃতি দিয়ে যোগ করা যায়।
if lang_name == 'বাংলা' then
if lex_cat == 'Q1084' then -- বিশেষ্য
base_form = formWithSingleGrammaticalFeature( 'Q131105' ) -- কর্তৃকারক
elseif lex_cat == 'Q24905' then -- ক্রিয়া
base_form = formWithSingleGrammaticalFeature( 'Q1350145' ) -- ক্রিয়া বিশেষ্য
end
end
if base_form == nil then
for i, form in pairs(forms) do
base_form = form
break
end
end
return base_form
end
local function getCombines( current_lexeme, frame )
local combines = ''
local index_mappings = {}
for i, stmt in pairs(current_lexeme:getAllStatements('P5238')) do
if stmt.qualifiers and stmt.qualifiers['P1545'] then -- ক্রম
local current_index = tonumber(stmt.qualifiers['P1545'][1].datavalue.value)
index_mappings[current_index] = stmt
end
end
if #index_mappings ~= 0 then
for i, stmt in ipairs(index_mappings) do
if stmt.mainsnak.datavalue then
local part_lexeme_id = stmt.mainsnak.datavalue.value.id
local part_lexeme = getEntity(part_lexeme_id)
local current_substring = getLinkedLemmata(part_lexeme)
local part_etymology = getEtymology(part_lexeme, frame, 'partial')
if part_etymology ~= '' and part_etymology then
current_substring = current_substring .. ' (← ' .. part_etymology .. ')'
end
if combines == '' then
combines = current_substring
else -- @TODO: This shoukd use the 'affix' and 'compound' templates instead.
combines = combines .. ' + ' .. current_substring
end
end
end
end
return combines
end
function getRoots( current_lexeme )
local stmts = current_lexeme:getAllStatements('P5920')
if #stmts == 0 then return '', '', '' end
local root_lexeme = getEntity(stmts[1].mainsnak.datavalue.value.id)
return getLexemeLanguageCode(root_lexeme), '√' .. getLinkedLemmata(root_lexeme), root_lexeme:getLemma('ar')
end
function getEtymology( current_lexeme, frame, mode )
-- @TODO: Fix the etymology chains that are not possible to render
local etymology = ''
local current_combines = getCombines(current_lexeme, frame)
local root_lang, current_roots, root_str = getRoots(current_lexeme)
if mode ~= 'partial' and root_str then
--frame:expandTemplate{title=i18n['template_root'], args={lang_code, root_lang, root_str}}
end
local stmts = current_lexeme:getAllStatements('P5191')
local new_etymology_string
if #stmts == 0 then
if current_roots ~= '' and current_combines ~= '' and current_roots then
return current_roots .. '<br/>(' .. current_combines .. ')'
elseif current_roots ~= '' then
if lang_code == 'ar' and mode ~= 'partial' and root_str ~= matched_lemma then
return frame:expandTemplate{title=i18n['template_ar-rootbox'], args={root_str}}
else
return current_roots
end
else
return current_combines
end
end
local origin_lexeme_string
for i, stmt in pairs(stmts) do
local origin_lexeme_dv = stmt.mainsnak.datavalue -- If this is nil, the origin lexeme is not known.
if origin_lexeme_dv then
local origin_lexeme = getEntity(origin_lexeme_dv.value.id)
local origin_lexeme_lang = getLabel(origin_lexeme:getLanguage())
local sitelink = i18n.wplink(origin_lexeme:getLanguage(), origin_lexeme_lang, wb)
if sitelink ~= '' then
origin_lexeme_string = getLinkedLemmata(origin_lexeme) .. ' (' .. sitelink .. ')'
else
origin_lexeme_string = getLinkedLemmata(origin_lexeme) .. ' (' .. origin_lexeme_lang .. ')'
end
if stmt.qualifiers and stmt.qualifiers['P5886'] then
local mode_of_derivation = stmt.qualifiers['P5886'][1].datavalue.value.id
if mode_of_derivation == 'Q1345001' then
-- @TODO: Add support for showing gender
origin_lexeme_string = frame:expandTemplate{title=i18n['template_borrowed'], args={lang_code, getLexemeLanguageCode(origin_lexeme), getLemmata(origin_lexeme), pos=getLabel(lex_cat)}} .. ' ' .. i18n['etymology_borrowing']
elseif mode_of_derivation == 'Q845079' then
origin_lexeme_string = ustring.gsub(i18n['etymology_learned_borrowing'], '$1', origin_lexeme_string)
elseif mode_of_derivation == 'Q56611986' then
origin_lexeme_string = frame:expandTemplate{title=i18n['template_inherited'], args={lang_code, getLexemeLanguageCode(origin_lexeme), getLemmata(origin_lexeme), pos=getLabel(lex_cat)}} .. ' ' .. i18n['etymology_inheritance']
elseif mode_of_derivation == 'Q189743' then
origin_lexeme_string = frame:expandTemplate{title=i18n['template_ellipsis'], args={lang_code, getLemmata(origin_lexeme)}} .. ' ' .. i18n['etymology_ellipsis']
end
end
local origin_origin = getEtymology(origin_lexeme, frame)
if origin_origin ~= '' and origin_origin then
new_etymology_string = origin_lexeme_string .. ' ← ' .. origin_origin
else
new_etymology_string = origin_lexeme_string
end
end
if etymology == '' then
etymology = new_etymology_string
elseif origin_lexeme_string and etymology then
etymology = etymology .. ' ' .. origin_lexeme_string
elseif origin_lexeme_string and etymology == nil then
etymology = origin_lexeme_string
end
end
if current_roots ~= '' and etymology and current_roots then
etymology = etymology .. ' ' .. current_roots
elseif current_roots ~= '' and etymology == nil then
etymology = current_roots
end
if current_combines ~= '' and etymology then
etymology = etymology .. '<br/>(' .. current_combines .. ')'
end
return etymology
end
local function pronunciationBlock(block, value)
return '* ' .. i18n['text_' .. block] .. ' ' .. value
end
local function getPronunciation( frame, current_lexeme, lang_name, lex_cat )
local pronunciations = {}
local base_form = getPronunciationBaseForm(lang_name, lex_cat )
if base_form then
for i, stmt in pairs(base_form:getAllStatements('P443')) do -- উচ্চারণের অডিও
local pronunciation_file = stmt.mainsnak.datavalue.value
local specifier_text = ''
local specifiers = {}
if stmt.qualifiers then
for k, property_id in ipairs({'P5237'}) do -- উচ্চারণের ধরন
local qual = stmt.qualifiers[property_id]
if qual then
for _, qual in pairs(qual) do
local stmt_value = qual.datavalue.value.id
table.insert(specifiers, getLabel(stmt_value))
end
end
end
end
if #specifiers > 0 then
specifier_text = table.concat(specifiers, "'', ''")
end
local audio_text
if specifier_text ~= '' then
audio_text = i18n['text_audio'] .. ' (' .. specifier_text .. ')'
else
audio_text = i18n['text_audio']
end
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title= i18n['template_audio'],
args = {lang_name, pronunciation_file, audio_text}
})
end
local ipa_transcription = base_form:getAllStatements('P898') -- - আধ্বব প্রতিলিপিকরণ
local iso15919_transcription = getOneStringForProperty(base_form, 'P5825') -- আইএসও ১৫৯১৯ প্রতিলিপিকরণ
local itrans = getOneStringForProperty(base_form, 'P8881') -- ITRANS
local iast = getOneStringForProperty(base_form, 'P7581') -- আইএএসটি প্রতিলিপিকরণ
local xsampa = getOneStringForProperty(base_form, 'P2859')
-- @TODO: অডিও ও প্রতিলিপিকরণ দুটোই থাকলে সেই ক্ষেত্রে একটার ঠিক পরেই আরেকটা দেখানো উচিত
if #ipa_transcription ~= 0 then
for i, stmt in pairs(ipa_transcription) do
local ipa_text = stmt.mainsnak.datavalue.value
local specifier_text = ''
local specifiers = {}
if stmt.qualifiers then
for k, property_id in ipairs({'P5237'}) do -- উচ্চারণের ধরন
for l, qual in ipairs(stmt.qualifiers[property_id]) do
table.insert(specifiers, getLabel( qual.datavalue.value.id ))
end
end
end
if #specifiers > 0 then
specifier_text = "(''" .. table.concat(specifiers, "'', ''") .. "'') "
end
local syllable_count
if lang_code == 'tr' then
syllable_count = i18n['text_syllable_count'] .. ' ' .. callWikifunctionsFunction('Z10029|' .. ipa_text, frame)
else
syllable_count = i18n['text_syllable_count'] .. ' ' .. callWikifunctionsFunction('Z30837|' .. ipa_text, frame)
end
table.insert(pronunciations, '* ' .. specifier_text .. frame:expandTemplate{
title= i18n['template_ipa'],
args = {lang_name, ipa_text}
} .. '\n* ' .. syllable_count)
end
-- The following checks are ordered based on which one is expected to be true in a higher number of cases.
elseif lang_name == 'বাংলা' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='bn-IPA',
})
elseif lang_name == 'আরবি' then
local lemma = current_lexeme:getLemma('ar')
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='ar-IPA',
args={lemma}
})
elseif lang_name == 'ফালা' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='fax-pron',
})
elseif lang_code == 'fi' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='fi-IPA',
})
elseif lang_code == 'ko' then
table.insert(pronunciations, '* ' .. frame:expandTemplate{
title='ko-IPA',
})
end
if iso15919_transcription then
table.insert(pronunciations, pronunciationBlock('iso15919', iso15919_transcription))
end
if itrans then
table.insert(pronunciations, pronunciationBlock('itrans', itrans))
end
if iast then
table.insert(pronunciations, pronunciationBlock('iast', iast))
end
if xsampa then
table.insert(pronunciations, pronunciationBlock('xsampa', xsampa))
end
end -- {{আধ্বব|en|/ˈɪntəvjuː/}}
return table.concat(pronunciations, '\n')
end
local function getAlternativeSpellings( current_lexeme )
local alt_spellings = {}
for i, stmt in pairs(current_lexeme:getAllStatements('P11577')) do -- বিকল্প বানান
if stmt.mainsnak.datavalue then
table.insert(alt_spellings, '* ' .. getLinkedLemmata(getEntity(stmt.mainsnak.datavalue.value.id)))
end
end
return table.concat(alt_spellings, '\n')
end
local function heading_level(text, level)
local heading_delimiter = string.rep('=', level)
return heading_delimiter .. ' ' .. text .. ' ' .. heading_delimiter
end
function get_any_notes(sections, args, keys)
local notes = {}
for i, v in ipairs(keys) do
if args[v] then
table.insert(notes, args[v])
end
end
return notes
end
function add_specific_notes(sections, notes)
for i, v in ipairs(notes) do
table.insert(sections, v)
end
end
local function add_any_notes(sections, args, keys)
for i, v in ipairs(keys) do
if args[v] then
table.insert(sections, args[v])
end
end
end
local function getMatchingLemmaForPageTitle(lexeme, title)
local lemmas = lexeme:getLemmas()
local matched_lemma
for _, lemma_entry in ipairs(lemmas) do
local lemma = lemma_entry[1]
if lemma == title then
matched_lemma = lemma
break
end
end
if matched_lemma == nil and lang_code == 'ar' then -- Arabic lemmas do not match the title of the entry because those are written with different characters stripped out on Wiktionary
matched_lemma = lexeme:getLemma('ar')
end
return matched_lemma
end
local function buildLanguageAgnosticInflectionTable()
local has_image = false
local form_images = {}
for i, form in ipairs(forms) do
local form_image = form:getAllStatements('P7407')
if next(form_image) then
form_images[i] = form_image[1].mainsnak.datavalue.value
has_image = true
end
end
local table_class = "wikitable mw-collapsible sortable"
if not has_image then
table_class = table_class .. " mw-collapsed"
end
local text = "{| class='" .. table_class .. "' style='border:solid 1px rgb(80%,80%,100%); text-align:center;'\n"
text = text .. "|+ " .. i18n['heading_inflection_table'] .. "\n"
text = text .. "|- \n"
text = text .. "! " .. i18n['heading_form'] .. " !! " .. i18n['heading_grammatical_features']
if has_image then
text = text .. " !! " .. (i18n['heading_image'])
end
text = text .. " \n"
for i, form in ipairs(forms) do
local rep = form:getRepresentations()
local feat = form:getGrammaticalFeatures()
local rep_text = ""
for j, r in pairs(rep) do
if rep_text == "" then
rep_text = r[1]
else
rep_text = rep_text .. " / " .. r[1]
end
end
local feat_text = ""
if feat then
for j, f in ipairs(feat) do
local label = getLabel(f) or f
if feat_text == "" then
feat_text = label
else
feat_text = feat_text .. ", " .. label
end
end
end
text = text .. "|-\n"
text = text .. "| " .. (rep_text ~= "" and rep_text or "—")
text = text .. " || " .. (feat_text ~= "" and feat_text or "—")
if has_image then
local image_cell = "—"
if form_images[i] then
image_cell = "[[চিত্র:" .. form_images[i] .. "|50px]]"
end
text = text .. " || " .. image_cell
end
text = text .. "\n"
end
text = text .. "|}"
return text
end
function p.all( frame )
local args = getArgs(frame)
local lexeme_id = args[1]
local current_lexeme = getEntity(lexeme_id)
local current_language = current_lexeme:getLanguage()
local senses = current_lexeme:getSenses()
local add_heading = true
forms = current_lexeme:getForms()
if args[2] then
local val = mw.text.trim(tostring(args[2]))
if val == "false" or val == "0" or val == "না" then
add_heading = false
end
end
local references_seen = {}
local sections = {}
local title = mw.title.getCurrentTitle().text
local lang_category = getLanguageForCategories(current_language, title)
local lang_name = getLabel(lang_category)
if add_heading == true then
local lang_heading = "== " .. lang_name .. " =="
table.insert(sections, lang_heading)
end
matched_lemma = getMatchingLemmaForPageTitle(current_lexeme, title)
lex_cat = current_lexeme:getLexicalCategory()
lang_code = getLexemeLanguageCode(current_lexeme)
local cat = i18n.lang_category(getLabel(lex_cat), lang_name)
local lex_cat_template
if cat then
table.insert(sections, '===' .. getLabel(lex_cat) .. cat .. frame:expandTemplate{
title = i18n['template_anchor'],
args = { lexeme_id }
} .. '===')
table.insert(sections, frame:expandTemplate{
title= i18n['template_lexeme'],
args = {lexeme_id}
})
add_any_notes(sections, args, i18n['manual_category'])
local etymology = getEtymology( current_lexeme, frame )
if etymology ~= '' and etymology then
table.insert(sections, heading_level(i18n['heading_etymology'], 4))
table.insert(sections, tostring(etymology))
end
add_any_notes(sections, args, i18n['manual_etymology'])
local pronunciation = getPronunciation( frame, current_lexeme, lang_name, lex_cat )
if pronunciation ~= '' then
table.insert(sections, heading_level(i18n['heading_pronunciation'], 4))
table.insert(sections, tostring(pronunciation))
end
add_any_notes(sections, args, i18n['manual_pronunciation'])
local alternative_spellings = getAlternativeSpellings( current_lexeme )
if alternative_spellings ~= '' then
table.insert(sections, heading_level(i18n['heading_alternative_spellings'], 4))
table.insert(sections, alternative_spellings)
end
if lang_code and lang_code ~= 'ksy' and lang_code ~= 'rkt' then -- Skip for Kharia Thar, Rangpuri
if lex_cat == 'Q34698' then -- বিশেষণ
if lang_code == 'en' or lang_code == 'bn' then
if #forms <= 1 then
lex_cat_template = frame:expandTemplate{title= lang_code .. '-বিশেষণ'}
end
else
lex_cat_template = safeExpand(frame, lang_code .. '-adj')
if not lex_cat_template then
lex_cat_template = safeExpand(frame, lang_code .. '-বিশেষণ')
end
end
elseif lex_cat == 'Q1084' then -- @TODO: Also check for plural forms
local gender
local stmts = current_lexeme:getAllStatements('P5185') -- ব্যাকরণগত লিঙ্গ
if #stmts ~= 0 then
if #stmts == 1 then
local gender_qid = stmts[1].mainsnak.datavalue.value.id
if gender_qid == 'Q499327' then
gender = 'm'
elseif gender_qid == 'Q1775415' then
gender = 'f'
elseif gender_qid == 'Q1775461' then
gender = 'n'
elseif gender_qid == 'Q1305037' then
gender = 'c'
end
end
else
for i, stmt in pairs(stmts) do
local qid = stmts[i].mainsnak.datavalue.value.id
if qid == 'Q499327' then
gender = gender .. 'm'
elseif qid == 'Q1775415' then
gender = gender .. 'f'
end
end
end
-- The following checks are ordered based on which one is expected to be true in a higher number of cases.
if current_language == 'Q13955' then
if matched_lemma then
lex_cat_template = safeExpand(frame, {title='ar-noun', args={matched_lemma,gender}})
else
lex_cat_template = frame:expandTemplate{title='ar-noun', args={nil,gender}}
end
elseif current_language == 'Q29919' then
lex_cat_template = frame:expandTemplate{title='arz-noun', args={g=gender}}
elseif current_language == 'Q397' then
if matched_lemma then
lex_cat_template = frame:expandTemplate{title='la-noun', args={matched_lemma,g=gender}}
end
elseif current_language == 'Q11059' then
lex_cat_template = frame:expandTemplate{title='sa-noun', args={g=gender}}
elseif current_language ~= 'Q1860' then -- These templates require the gender to be passed as the 1st argument.
lex_cat_template = safeExpand(frame, lang_code .. i18n['noun_template_suffix'], {gender})
if not lex_cat_template then
lex_cat_template = safeExpand(frame, lang_code .. i18n['noun_template_suffix_fallback'], {gender})
end
end
end
end
-- elseif lex_cat == 'Q147276' then
-- lex_cat_template = safeExpand(frame, lang_code .. '-proper noun', {gender})
-- if not lex_cat_template then
-- lex_cat_template = safeExpand(frame, lang_code .. '-নামবাচক বিশেষ্য', {gender})
-- end
end
if lex_cat_template then
table.insert(sections, lex_cat_template)
else
if matched_lemma then
table.insert(sections, heading_level(matched_lemma, 4))
else
table.insert(sections, i18n.tocatlink(i18n['category_no_matching_lemma']))
end
end
local meanings, references_seen, sense_extlinks = unpack(getMeanings( frame, args, current_lexeme, senses, references_seen, lang_name))
table.insert(sections, tostring(meanings))
add_any_notes(sections, args, i18n['manual_meaning'])
local instance_of = current_lexeme:getAllStatements('P31') -- সত্ত্বার ধরন
if #instance_of ~= 0 then
local instance_of_entity = instance_of[1].mainsnak.datavalue.value.id
if instance_of_entity == 'Q40437546' or instance_of_entity == 'Q120831827' or instance_of_entity == 'Q120717979' or instance_of_entity == 'Q124476844' then -- @TODO: generalise this so all types of roots are shown
table.insert(sections, i18n['text_instance_of'] .. ' ' .. getLabel(instance_of_entity))
elseif instance_of_entity == 'Q376431' then -- বর্ণের নাম
table.insert(sections, i18n.tocatlink(lang_code .. ':রং'))
end
end
local translations = getTranslations(frame, senses)
if translations then
table.insert(sections, translations)
end
-- (!) বিশেষ ভাষার বিভক্তির সারণি যদি থাকে সেগুলো এখানে নতুন if বিবৃতি যোগ করা যায়।
if next(forms) then
if current_language == 'Q9610' then -- বাংলা
if lex_cat == 'Q24905' then
local conjTable = require('মডিউল:আভিধানিক উপাত্ত/Q9610').getConjTable(frame, forms)
table.insert(sections, conjTable)
elseif lex_cat == 'Q1084' then
--table.insert(sections, callWikifunctionsFunction('Z33243|' .. lexeme_id .. '|', frame))
table.insert(sections, buildLanguageAgnosticInflectionTable())
elseif lex_cat == 'Q34698' then
if #forms > 1 then
table.insert(sections, buildLanguageAgnosticInflectionTable())
end
end
--elseif current_language == 'Q13955' then -- আরবি
-- if lex_cat == 'Q1084' then
-- table.insert(sections, frame:expandTemplate{title='ar-decl-noun', args={lemma}})
-- end
elseif current_language == 'Q188' then -- জার্মান
if lex_cat == 'Q1084' then
table.insert(sections, callWikifunctionsFunction('Z28602|' .. lexeme_id .. '|', frame))
end
else
if #forms > 1 then
table.insert(sections, buildLanguageAgnosticInflectionTable())
end
end
end
if lex_cat == 'Q134830' then
table.insert(sections, frame:expandTemplate{title='prefixsee', args={lang_code}})
elseif lex_cat == 'Q102047' then
table.insert(sections, frame:expandTemplate{title='suffixsee', args={lang_code}})
-- elseif lex_cat == 'Q111029' then
-- table.insert(sections, frame:expandTemplate{title='rootsee', args={'+', lang_code, matched_lemma}})
end
local reference_notes = get_any_notes(sections, args, i18n['manual_reference'])
if #references_seen > 0 or #reference_notes > 0 then
table.insert(sections, heading_level(i18n['heading_references'], 4))
table.insert(sections, frame:extensionTag('references'))
add_specific_notes(sections, reference_notes)
end
local external_link_table = getExternalLinks ( current_lexeme )
if #external_link_table > 0 then
local external_links = '* ' .. table.concat(external_link_table, '\n* ')
table.insert(sections, heading_level(i18n['heading_external_links'], 4))
table.insert(sections, external_links)
end
add_any_notes(sections, args, i18n['manual_external_link'])
if #references_seen == 0 and #reference_notes == 0 and sense_extlinks and #sense_extlinks == 0 and #external_link_table == 0 and #get_any_notes(sections, args, i18n['manual_external_link']) == 0 then
table.insert(sections, i18n.rfref_category(lang_name))
end
return table.concat(sections,"\n\n")
end
return p
9l1chcsyvu4h5v4ee5zujzt33jrkbqh
টেমপ্লেট:ar-verb
10
66535
509630
203814
2026-06-03T11:25:23Z
Redmin
6857
/* */ ইংরেজি উইকিঅভিধান থেকে হালনাগাদ করলাম
509630
wikitext
text/x-wiki
<includeonly>{{#invoke:ar-headword|show|verbs}}</includeonly><noinclude>{{documentation}}</noinclude>
2n1tkh8yz35wegfv5varj5vfxrloknt
আধ্যাত্মিক
0
82395
509628
467632
2026-06-03T10:50:30Z
~2026-32755-50
14765
/* উচ্চারণ */ Google এ আধ্যাত্মিক শব্দের সঠিক উচ্চারণ সার্চ দিলে ভুল ফল দেখাতো। গুগলে দেখায় এর সঠিক উচ্চারণ হবে আদ-ধাত-মিক যার সূত্র এই পেজকে নির্দেশ করে। তাই বাংলায় এর সঠিক উচ্চারণটি প্রয়োজন ছিল যেন পরবর্তীতে আর বিভ্রান্তিতে পড়তে না হয়।
509628
wikitext
text/x-wiki
== {{ভাষা|bn}} ==
=== উচ্চারণ ===
আদ্ধাত্তিঁক্
* {{bn-IPA}}
=== বিশেষণ ===
{{bn-বিশেষণ}}
# [[পারমার্থিক]]। [[আত্মা]] থেকে জাত; আত্মাসম্বন্ধীয়। (বিশেষ্য: আধ্যাত্মিকতা)।
n3jjn1j74wuouwf53v9c20rqh48logq
ব্রাহ্মণবাড়িয়া
0
134763
509623
459938
2026-06-03T04:12:18Z
~2026-32948-51
14763
Removed unreliable information
509623
wikitext
text/x-wiki
=={{ভাষা|bn}}==
{{wikipedia|lang=bn|sc=Beng}}
===বিকল্প রূপ===
* {{alt|bn|বামনবাড়িয়া|বামুনবাড়িয়া|বাউনবাড়িয়া|বাওনবাড়িয়া||non-Sanskritised forms}}
* {{alt|bn|বামনবাইড়া|বামুনবাইড়া|বাউনবাইড়া|বাওনবাইড়া|tr1=bamonbaiṛa||Vanga|non-Sanskritised forms}}
===ব্যুৎপত্তি===
[[Sanskritised]] form of {{m|bn|বামুনবাড়িয়া}} and its several byforms; এর উৎস {{af|bn|বামন|alt1=বামুন|t1=Brahmin|বাড়ি|t2=home|-ইয়া|pos3=adjectival suffix}}।
There are several opinions about the naming of Brahmanbaria district. It is noted in ''The History of Naming'' (বাংলা: নামকরণের ইতিকথা) by SM Shah Nur that during the rule of the [[w:Sena dynasty|Senas]], the area (then known as Rang) lacked a Brahmin presence which would was not ideal for [[puja]]। To solve this problem, the Sena king brought some Brahmin families from {{w|Kannauj}} to inhabit Rang, which was later renamed as their residence.<ref>{{cite-journal|url=http://www.thedailystar.net/in-focus/songs-the-river-called-titas-1265137|work=[[w:The Daily Star (Bangladesh)|The Daily Star]]|title=Songs from the River called Titas|date=Aug 6, 2016}}</ref><ref name=":0">{{cite-journal|bn|url=https://www.banglatribune.com/429118/%E0%A6%AC%E0%A7%8D%E0%A6%B0%E0%A6%BE%E0%A6%B9%E0%A7%8D%E0%A6%AE%E0%A6%A3%E0%A6%A6%E0%A7%87%E0%A6%B0-%E0%A6%AC%E0%A6%BE%E0%A7%9C%E0%A6%BF%E0%A6%B0-%E0%A6%85%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%A5%E0%A6%BE%E0%A6%A8%E0%A7%87%E0%A6%B0-%E0%A6%B8%E0%A7%81%E0%A6%AC%E0%A6%BE%E0%A6%A6%E0%A7%87|title=ব্রাহ্মণদের বাড়ির অবস্থানের সুবাদে ‘ব্রাহ্মণবাড়িয়া’|work=[[w:Bangla Tribune|Bangla Tribune]]|accessdate=2021-06-03}}</ref>
===উচ্চারণ===
* {{bn-IPA|bɾammōnবাড়িয়া|bɾamɦōnবাড়িয়া}}
===বিশেষ্য===
{{bn-noun}}
# {{place|bn|শহর|c/বাংলাদেশ|t=Brahmanbaria}}|
====উদ্ভূত শব্দ====
* {{l|bn|ব্রাহ্মণবাড়িয়া জেলা}}
* {{l|bn|বি-বাড়িয়া}}
===তথ্যসূত্র===
<references/>
9iy2mtxi9vgo9bq7zej32lqt9c1inwv
মডিউল:আভিধানিক উপাত্ত/i18n
828
148710
509629
509308
2026-06-03T11:20:52Z
Redmin
6857
509629
Scribunto
text/plain
local p = {}
p['fallback_wikipedia'] = 'enwiki'
p['content_lang_name'] = 'বাংলা'
p['content_lang_code'] = mw.ustring.gsub(mw.site.wikiId, 'wiktionary', '')
p['wikipedia'] = p['content_lang_code'] .. 'wiki'
p['heading_etymology'] = 'ব্যুৎপত্তি'
p['heading_pronunciation'] = 'উচ্চারণ'
p['heading_translation'] = 'অনুবাদ'
p['heading_references'] = 'তথ্যসূত্র'
p['heading_external_links'] = 'বহিঃসংযোগ'
p['heading_alternative_spellings'] = 'বিকল্প বানান'
p['heading_inflection_table'] = 'বিভক্তির সারণী'
p['heading_form'] = 'রূপ'
p['heading_grammatical_features'] = 'ব্যাকরণিক বৈশিষ্ট্য'
p['heading_image'] = 'চিত্র'
p['heading_alternative_script'] = 'বিকল্প রূপ'
p['text_instance_of'] = 'একটি'
p['text_audio'] = 'অডিও'
p['text_iso15919'] = '[[w:আইএসও ১৫৯১৯|আইএসও ১৫৯১৯]]:'
p['text_iast'] = '[[w:সংস্কৃত লিপ্যন্তরের আন্তর্জাতিক বর্ণমালা|সলিআব]]:'
p['text_itrans'] = '[[w:en:ITRANS|ITRANS]]:'
p['text_xsampa'] = '[[w:এক্স-সাম্পা|এক্স-সাম্পা]]:'
p['text_syllable_count'] = '[[w:অক্ষর (সিলেবল)|অক্ষর]] সংখ্যা:'
p['template_lexeme'] = 'উইকিউপাত্ত লেক্সিম' -- Q81739987
p['template_wikipedia'] = 'উইকিপিডিয়া' -- Q6275256
p['template_audio'] = 'অডিও ভাষার নাম' -- Q138620346
p['template_anchor'] = 'anchor' -- Q5412976
p['template_rfdef'] = 'rfdef' -- Q30733154
p['template_ipa'] = 'আধ্বব ভাষার নাম' -- Q138608718
p['template_trans-top'] = 'অনুবাদ-শীর্ষ' -- Q30528422
p['template_trans-bottom'] = 'অনুবাদ-নিচ' -- Q30528419
p['template_antonym'] = 'বিপরীতার্থক' -- Q35305357
p['template_synonym'] = 'synonyms' -- Q32751230
p['template_hypernym'] = 'hypernyms' -- Q35305454
p['template_demonym-noun'] = 'demonym-noun' -- Q130360250
p['template_demonym-adj'] = 'demonym-adj' -- Q135184225
p['template_homophones'] = 'সমোচ্চারিত' -- Q30557565
p['template_borrowed'] = 'ধারকৃত শব্দ' -- Q30872304
p['template_inherited'] = 'inherited' -- Q30864051
p['template_ar-rootbox'] = 'ar-rootbox' -- Q115627074
p['template_root'] = 'root' -- Q104521645
p['template_ellipsis'] = 'ellipsis' -- Q107037827
p['template_prefixsee'] = 'prefixsee' -- Q47517865
p['template_rootsee'] = 'rootsee' -- Q105987491
p['template_suffixsee'] = 'suffixsee' -- Q47517855
p['noun_template_suffix'] = '-noun'
p['noun_template_suffix_fallback'] = '-বিশেষ্য'
p['proper noun_template_suffix'] = '-proper noun'
p['proper noun_template_suffix_fallback'] = '-নামবাচক বিশেষ্য'
p['verb_template_suffix'] = '-verb'
p['verb_template_suffix_fallback'] = '-ক্রিয়া'
p['manual_category'] = {'বিষয়শ্রেণী', 'category'}
p['manual_etymology'] = {'ব্যুৎপত্তি', 'etymology'}
p['manual_pronunciation'] = {'উচ্চারণ', 'pronunciation'}
p['manual_meaning'] = {'অর্থ', 'meaning'}
p['manual_reference'] = {'তথ্যসূত্র', 'reference'}
p['manual_external_link'] = {'বহিঃসংযোগ', 'external_link'}
p['etymology_borrowing'] = 'থেকে [[w:ঋণশব্দ|ঋণকৃত]]'
p['etymology_learned_borrowing'] = '$1 থেকে [[d:Q845079|শিক্ষিতভাবে ঋণকৃত]]'
p['etymology_inheritance'] = 'থেকে [[উত্তরলব্ধ]]'
p['etymology_ellipsis'] = '[[w:en:Ellipsis (linguistics)|সংক্ষিপ্ত হয়ে]] উপলব্ধ'
-- অংশচ্ছেদ (ভাষাবিজ্ঞান)
p['edit_wikidata'] = 'উইকিউপাত্তে সম্পাদনা করুন'
-- বিষয়শ্রেণী যেগুলো অন্য উইকিঅভিধানে আছে
p['category_rfdef'] = 'ভাষা অনুযায়ী সংজ্ঞার জন্য অনুরোধ' -- Q33129136
p['category_rfdef_equivalent'] = 'শব্দার্থের বাংলা মানের অনুরোধ' -- [[:wikt:en:Category:Requests for English equivalent term by language]]-এর কাছাকাছি
p['category_no_matching_lemma'] = 'যেসব ভুক্তিতে লেমার হেডিং দেখানো অসম্ভব' -- Entries will be put in this category whenever a lemma heading cannot be rendered because no lemma of the linked lexeme matched the page title.
p['category_given_names'] = 'প্রদত্ত নাম' -- Q8492384
-- বিষয়শ্রেণী যেগুলো অন্য উইকিঅভিধানে নেই
p['text_category_rfdef'] = 'এই শব্দের লেক্সিমে অর্থ প্রয়োজন। দয়া করে লেক্সিম পাতায় গিয়ে একটি অর্থ যোগ করুন, যাতে অন্য পাঠকরা জানতে পারবে এটা মানে কি।'
function p.tocatlink(str)
return '[[বিষয়শ্রেণী:' .. str .. ']]'
end
function p.lang_category(lex_cat, language)
local cat_text = p.tocatlink(language .. ' লেমা')
cat_text = cat_text .. p.tocatlink(language .. ' ' .. lex_cat)
return cat_text
end
function p.wplink(qid, display_text, wb)
local link = wb.getSitelink(qid, p['wikipedia'])
if link == nil then
link = wb.getSitelink(qid, p['fallback_wikipedia'])
if link ~= nil then
return '[[w:en:' .. link .. '|' .. display_text .. ']]'
end
else
return '[[w:' .. link .. '|' .. display_text .. ']]'
end
return ''
end
function p.rfref_category(language)
local cat_text = p.tocatlink('তথ্যসূত্রহীন ' .. language .. ' শব্দ',language)
return cat_text
end
p.nolinks = { -- These are words that are so commonly used that links to entries about them are unnecessary.
['করা'] = true,
['হওয়া'] = true,
['যাওয়া'] = true,
['যে'] = true,
['ও'] = true,
['তার'] = true,
['এবং'] = true,
['যার'] = true,
['যায়'] = true,
}
return p
j9qai6dy6vg8rod19zpcjgp6zapzhy9
509631
509629
2026-06-03T11:30:37Z
Redmin
6857
509631
Scribunto
text/plain
local p = {}
p['fallback_wikipedia'] = 'enwiki'
p['content_lang_name'] = 'বাংলা'
p['content_lang_code'] = 'bn' -- The proper way to do this would be to use mw.ustring.gsub(mw.site.wikiId, 'wiktionary', '') but that does mean wasting compute so instead, just use the 'cached' config which isn't really labour-intensive.
p['wikipedia'] = 'bnwiki' -- p['content_lang_code'] .. 'wiki'
p['heading_etymology'] = 'ব্যুৎপত্তি'
p['heading_pronunciation'] = 'উচ্চারণ'
p['heading_translation'] = 'অনুবাদ'
p['heading_references'] = 'তথ্যসূত্র'
p['heading_external_links'] = 'বহিঃসংযোগ'
p['heading_alternative_spellings'] = 'বিকল্প বানান'
p['heading_inflection_table'] = 'বিভক্তির সারণী'
p['heading_form'] = 'রূপ'
p['heading_grammatical_features'] = 'ব্যাকরণিক বৈশিষ্ট্য'
p['heading_image'] = 'চিত্র'
p['heading_alternative_script'] = 'বিকল্প রূপ'
p['text_instance_of'] = 'একটি'
p['text_audio'] = 'অডিও'
p['text_iso15919'] = '[[w:আইএসও ১৫৯১৯|আইএসও ১৫৯১৯]]:'
p['text_iast'] = '[[w:সংস্কৃত লিপ্যন্তরের আন্তর্জাতিক বর্ণমালা|সলিআব]]:'
p['text_itrans'] = '[[w:en:ITRANS|ITRANS]]:'
p['text_xsampa'] = '[[w:এক্স-সাম্পা|এক্স-সাম্পা]]:'
p['text_syllable_count'] = '[[w:অক্ষর (সিলেবল)|অক্ষর]] সংখ্যা:'
p['template_lexeme'] = 'উইকিউপাত্ত লেক্সিম' -- Q81739987
p['template_wikipedia'] = 'উইকিপিডিয়া' -- Q6275256
p['template_audio'] = 'অডিও ভাষার নাম' -- Q138620346
p['template_anchor'] = 'anchor' -- Q5412976
p['template_rfdef'] = 'rfdef' -- Q30733154
p['template_ipa'] = 'আধ্বব ভাষার নাম' -- Q138608718
p['template_trans-top'] = 'অনুবাদ-শীর্ষ' -- Q30528422
p['template_trans-bottom'] = 'অনুবাদ-নিচ' -- Q30528419
p['template_antonym'] = 'বিপরীতার্থক' -- Q35305357
p['template_synonym'] = 'synonyms' -- Q32751230
p['template_hypernym'] = 'hypernyms' -- Q35305454
p['template_demonym-noun'] = 'demonym-noun' -- Q130360250
p['template_demonym-adj'] = 'demonym-adj' -- Q135184225
p['template_homophones'] = 'সমোচ্চারিত' -- Q30557565
p['template_borrowed'] = 'ধারকৃত শব্দ' -- Q30872304
p['template_inherited'] = 'inherited' -- Q30864051
p['template_ar-rootbox'] = 'ar-rootbox' -- Q115627074
p['template_root'] = 'root' -- Q104521645
p['template_ellipsis'] = 'ellipsis' -- Q107037827
p['template_prefixsee'] = 'prefixsee' -- Q47517865
p['template_rootsee'] = 'rootsee' -- Q105987491
p['template_suffixsee'] = 'suffixsee' -- Q47517855
p['noun_template_suffix'] = '-noun'
p['noun_template_suffix_fallback'] = '-বিশেষ্য'
p['proper noun_template_suffix'] = '-proper noun'
p['proper noun_template_suffix_fallback'] = '-নামবাচক বিশেষ্য'
p['verb_template_suffix'] = '-verb'
p['verb_template_suffix_fallback'] = '-ক্রিয়া'
p['manual_category'] = {'বিষয়শ্রেণী', 'category'}
p['manual_etymology'] = {'ব্যুৎপত্তি', 'etymology'}
p['manual_pronunciation'] = {'উচ্চারণ', 'pronunciation'}
p['manual_meaning'] = {'অর্থ', 'meaning'}
p['manual_reference'] = {'তথ্যসূত্র', 'reference'}
p['manual_external_link'] = {'বহিঃসংযোগ', 'external_link'}
p['etymology_borrowing'] = 'থেকে [[w:ঋণশব্দ|ঋণকৃত]]'
p['etymology_learned_borrowing'] = '$1 থেকে [[d:Q845079|শিক্ষিতভাবে ঋণকৃত]]'
p['etymology_inheritance'] = 'থেকে [[উত্তরলব্ধ]]'
p['etymology_ellipsis'] = '[[w:en:Ellipsis (linguistics)|সংক্ষিপ্ত হয়ে]] উপলব্ধ'
-- অংশচ্ছেদ (ভাষাবিজ্ঞান)
p['edit_wikidata'] = 'উইকিউপাত্তে সম্পাদনা করুন'
-- বিষয়শ্রেণী যেগুলো অন্য উইকিঅভিধানে আছে
p['category_rfdef'] = 'ভাষা অনুযায়ী সংজ্ঞার জন্য অনুরোধ' -- Q33129136
p['category_rfdef_equivalent'] = 'শব্দার্থের বাংলা মানের অনুরোধ' -- [[:wikt:en:Category:Requests for English equivalent term by language]]-এর কাছাকাছি
p['category_no_matching_lemma'] = 'যেসব ভুক্তিতে লেমার হেডিং দেখানো অসম্ভব' -- Entries will be put in this category whenever a lemma heading cannot be rendered because no lemma of the linked lexeme matched the page title.
p['category_given_names'] = 'প্রদত্ত নাম' -- Q8492384
-- বিষয়শ্রেণী যেগুলো অন্য উইকিঅভিধানে নেই
p['text_category_rfdef'] = 'এই শব্দের লেক্সিমে অর্থ প্রয়োজন। দয়া করে লেক্সিম পাতায় গিয়ে একটি অর্থ যোগ করুন, যাতে অন্য পাঠকরা জানতে পারবে এটা মানে কি।'
function p.tocatlink(str)
return '[[বিষয়শ্রেণী:' .. str .. ']]'
end
function p.lang_category(lex_cat, language)
local cat_text = p.tocatlink(language .. ' লেমা')
cat_text = cat_text .. p.tocatlink(language .. ' ' .. lex_cat)
return cat_text
end
function p.wplink(qid, display_text, wb)
local link = wb.getSitelink(qid, p['wikipedia'])
if link == nil then
link = wb.getSitelink(qid, p['fallback_wikipedia'])
if link ~= nil then
return '[[w:en:' .. link .. '|' .. display_text .. ']]'
end
else
return '[[w:' .. link .. '|' .. display_text .. ']]'
end
return ''
end
function p.rfref_category(language)
local cat_text = p.tocatlink('তথ্যসূত্রহীন ' .. language .. ' শব্দ',language)
return cat_text
end
p.nolinks = { -- These are words that are so commonly used that links to entries about them are unnecessary.
['করা'] = true,
['হওয়া'] = true,
['যাওয়া'] = true,
['যে'] = true,
['ও'] = true,
['তার'] = true,
['এবং'] = true,
['যার'] = true,
['যায়'] = true,
}
return p
5vmo79kwf11r9on30j1l4jtpmwfzzax