ഘടകം:Sandbox/Viswaprabha/1

വിക്കിപീഡിയ, ഒരു സ്വതന്ത്ര വിജ്ഞാനകോശം.

ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Sandbox/Viswaprabha/1/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്

--contact viswaprabha
-- പതിമൂന്നു് പതിമൂന്നാം പതിമൂന്നാമത്തെ പതിമൂന്നാമത് പതിമൂന്നിൽ പതിമൂന്നിന്റെ പതിമൂന്നുകൊണ്ട് പതിമൂന്നിനോടു കൂടി പതിമൂന്നിനേക്കാളും
local p = {} 
--------------------------------
function p.getAllArgs(frame ) -- This will be used for validation of input values 
    buf = {}
    for name, value in frame:argumentPairs() do
       if #buf ~= 0 then
          table.insert( buf, ', ' )
     end
    table.insert( buf, name .. '=' .. value )
	end
	return table.concat( buf )
end


function p.word(frame)  
	if tonumber(frame.args[1]) == nil then  word= "Bad argument" return word 	end

num = frame.args[1]
number = 0

cents={"","നൂറ്റി"," ഇരുനൂറ്റി","മുന്നൂറ്റി", "നാനൂറ്റി", "അഞ്ഞൂറ്റി", "അറുനൂറ്റി", "എഴുനൂറ്റി", "എണ്ണൂറ്റി", "തൊള്ളായിരത്തി"}
round10="്"
super10 = "്തി"
grands={"ആയിര","രണ്ടായിര","മൂവ്വായിര","നാലായിര","അയ്യായിര","ആറായിര","ഏഴായിര" , "എണ്ണായിര" ,"ഒമ്പതിനായിര"}
roundk="ം"
superk="ത്തി"
thousandcrores =0
ones =0
tens=0
hundreds=0
thousands=0
tenthousands = 0
lakhs= 0 
tenlakhs= 0
crores= 0
tencrores= 0
hundredcrores= 0


number = tonumber(num)

	if number  == nil then word = number.." അക്കത്തിലെഴുതിയ ഒരുഎണ്ണൽസംഖ്യയല്ല"
	elseif number <0 then word = number.." ഒരു പോസിറ്റീവ് സംഖ്യയല്ല"
	elseif math.floor(number) ~= number then 	word = number.." ഒരുഎണ്ണൽസംഖ്യയല്ല"
	elseif number == 0 then word = "പൂജ്യം"
	else
		if number > 9999999999	then thousandcrores		=math.floor(math.fmod (number, 100000000000	)/10000000000)	end
		if number > 999999999	then hundredcrores		=math.floor(math.fmod (number, 10000000000	)/1000000000)	end
		if number > 99999999	then tencrores			=math.floor(math.fmod (number, 1000000000	)/100000000)	end
		if number > 9999999		then crores				=math.floor(math.fmod (number, 100000000	)/10000000)		end
		if number > 999999		then tenlakhs			=math.floor(math.fmod (number, 10000000		)/1000000)		end
		if number > 99999		then lakhs				=math.floor(math.fmod (number, 1000000		)/100000)		end
		if number > 9999		then tenthousands		=math.floor(math.fmod (number, 100000		)/10000)		end
		if number > 999			then thousands			=math.floor(math.fmod (number, 10000		)/1000)			end
		if number > 99			then hundreds			=math.floor(math.fmod (number, 1000			)/100)			end
		if number > 9			then tens				=math.floor(math.fmod (number, 100			)/10)			end
		if number > 0			then ones				=math.floor(math.fmod (number, 10			))				end
	end	


singles= {"","ഒന്ന്","രണ്ട്","മൂന്ന്","നാല്","അഞ്ച്","ആറ്","ഏഴ്","എട്ട്","ഒമ്പത്"}
teens={ "പത്തു്", "പതിനൊന്നു്","പന്ത്രണ്ടു്", "പതിമൂന്നു്","പതിനാലു്","പതിനഞ്ച്","പതിനാറു്","പതിനേഴു്","പതിനെട്ടു്","പത്തൊമ്പതു്"}
decas={"ഇരുപത", "മുപ്പത","നാൽപ്പത" ,"അമ്പത","അറുപത","എഴുപത","എൺപത"}
decasingles={"്" , "്തൊന്ന്" , "്തിരണ്ട്" , "്തിമൂന്ന്" , "്തിനാല്" , "്തഞ്ച്" , "്താറ്" , "്തേഴ്" , "്തെട്ട്" , "്തൊമ്പത്"}
ninetysingles={"്","്റൊന്ന്","്റിരണ്ട്","്റിമൂന്ന്","്റിനാല്","്റഞ്ച്","്റാറ്","്റേഴ്","്റെട്ട്","്റൊമ്പത്"}
cents={"","നൂറ"," ഇരുനൂറ","മുന്നൂറ", "നാനൂറ", "അഞ്ഞൂറ", "അറുനൂറ", "എഴുനൂറ", "എണ്ണൂറ", "തൊള്ളായിര"}
supercent="്റി"--bug for 900
roundcent="്"
grands={"ആയിര","രണ്ടായിര","മൂവ്വായിര","നാലായിര","അയ്യായിര","ആറായിര","ഏഴായിര" , "എണ്ണായിര" ,"ഒമ്പതിനായിര"}
teengrands={"പതിനായിര","പതിനോരായിര","പന്ത്രണ്ടായിര","പതിമൂവ്വായിര","പതിനാലായിര","പതിനയ്യായിര","പതിനാറായിര","പതിനേഴായിര","പതിനെണ്ണായിര","പത്തൊമ്പതിനായിര"}
decagrands={" ിനായിര","്തോരായിര", "്തീരായിര","്തിമൂവ്വായിര","്തിനാലായിര","്തയ്യായിര","്താറായിര","്തേഴായിര" , "്തെണ്ണായിര" ,"്തൊമ്പതിനായിര"}
ninetygrands = {"തൊണ്ണൂറായിര","തൊണ്ണൂറ്റോരായിര","തൊണ്ണൂറ്റിരണ്ടായിര","തൊണ്ണൂറ്റിമൂവ്വായിര","തൊണ്ണൂറ്റിനാലായിര","തൊണ്ണൂറ്റയ്യായിര","തൊണ്ണൂറ്റാറായിര","തൊണ്ണൂറ്റേഴായിര","തൊണ്ണൂറ്റെട്ടായിര","തൊണ്ണൂറ്റൊമ്പതിനായിര"}
roundk="ം"
superk="ത്തി"
centi=tonumber(tens..ones)
tenk = tonumber(tenthousands..thousands)
tenlakh=tonumber(tenlakhs..lakhs)
--[[ാ േ  ീ  ൂ  ോ െ ി]]





if number == 100 then word = "നൂറ്" ; return 
	elseif centi == 0 then 
		if (tenk~=0 or tenlakh~=0) then word =  parthundreds[hundreds]
		elseif number < 1000 then word = cents[hundreds]..roundcent
		end
	elseif centi <= 10 then word=  singles[ones+1]
	elseif centi <= 20 then word = teens[ones+1]
	elseif centi <=90 then word =decas[tens-1]..decasingles[ones+1]
	elseif centi <=99 then word ="തൊണ്ണൂറ"..ninetysingles[ones+1]
end

if number == 1000 then word = "ആയിരം" ; return 
	elseif  centi == 0 and hundreds== 0 then word=roundk
	elseif tens == 1 then  word= cents[hundreds+1]..supercent.."പ്"..word
	elseif tens==9 then word = cents[hundreds+1]..supercent.."ത്"..word
	else word=cents[hundreds+1]..supercent..word
end


if tenk == 0 then -- dohighercheck()
	elseif tenk <= 10 then word= grands[thousands+1]..superk..word
	elseif tenk <= 20 then word = teengrands[thousands+1]..superk..word
	elseif tenk <=90 then word =decas[tenthousands-1]..decagrands[thousands+1]..superk..word
	elseif tenk <=99 then word =ninetygrands[thousands+1]..superk..word
end






--[[ifthousandcrores ~= 0 then thousandcrores = grands[thousandcrores +1]..superk end 
hundredcrores=cents[hundredcrores+1]
tencrores=decas[tencrores+1]
crores=singles[crores+1].." കോടി "
tenlakhs=ties[tenlakhs+1]
lakhs = singles[lakhs+1].." ലക്ഷത്തി"
tenthousands= decas[tenthousands+1]
thousands=grands[thousands+1]..superk
hundreds=cents[hundreds+1]
tens=decas[tens+1]
ones=singles[ones+1]]

word= thousandcrores..hundredcrores..tencrores..crores..tenlakhs..lakhs..tenthousands..thousands..hundreds..word
word = "For the number"..number..", the Equivalent word is=".. word
return word
end
return p
"https://ml.wikipedia.org/w/index.php?title=ഘടകം:Sandbox/Viswaprabha/1&oldid=2337991" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്