模組:Scoring

被永久保护的模块
维基百科,自由的百科全书
文档图示 模块文档[查看] [编辑] [历史] [清除缓存]

第十六屆動員令開始後使用此模板,過去計分方式紀錄於此

使用方法:{{#invoke:scoring|calculate|cat=<> |length=<> |rank=<> |isnew=<>}}

需要给入的要素:

cat (Category,类别)
表示条目属于动员令的种类:
大动员令用“1”表示,中动员令用“2”表示,小动员令用“3”表示。
length (长度)
表示条目的长度,单位为字节,
请直接输入数字。
rank (等级)
表示条目的等级,分为典范条目,典范列表,优良条目,达标条目四种
典范条目请输入“FA”,典范列表请输入“FL”,优良条目请输入“GA”,达标条目请输入“normal”
isnew (是新条目)
表示条目为新撰写的条目
如果是请输入“1”,如果不是(即改善条目)请输入“0”.

使用示例:

一个改善的长度为40,000字节的中动员令下属优良条目,应使用{{#invoke:scoring|calculate|cat=2 |length=40000 |rank=GA |isnew=0}}。
显示结果为146.3。

更多示例请见User:Lnnocentius/miscellaneous/模块:Scoring

local final_assessment = {}
function final_assessment.calculate()
	local args = mw.getCurrentFrame().args
	local cat = tonumber(args.cat, 10)
	local score = 0
	local multiplier = 0
	local length = tonumber(args.length, 10)
	local spokenlength = tonumber(args.spokenlength, 10)
	local refnum = tonumber(args.refnum, 10)
	local picnum = tonumber(args.picnum, 10)
	local fpicnum = tonumber(args.fpicnum, 10)
	local piclimit = math.min(6, math.floor(length/2000))
	local pictranslength = tonumber(args.pictranslength, 10)
	local videolength = tonumber(args.videolength, 10)
	if args.rank == 'FA' then
		score = 18.75 + 1.5 * length / 1000
	elseif args.rank == 'FL' then
		score = 18.75 + 1.25 * length / 1000
	elseif args.rank == 'GA' then
		score = 15 + length / 1000
	elseif args.rank == 'normal' then
		if length <= 100000 then
			score = -0.0025 * (length / 1000) ^ 2 + 0.52 * (length / 1000) + 1
		else
			score = 28
		end
	end
	--如果长度不合标准则归零
	if length < 3500 then
		score = 0
	end
	if args.isnew == '0' then
		--如果不是新条目
		if length == 3500 then
			score = 0
		end
		if args.rank == 'normal' then
			multiplier = 1.2
		elseif args.rank == 'FA' then
			multiplier = 1.4
		else
			multiplier = 1.3
		end
		--不同动员令改善条目加成修正,大(cat=1):中(2):小(3)= 0 : 3% : 5%
		multiplier = multiplier + ((-0.5 * cat * cat + 4.5 * cat - 4) / 100)
		score = score * multiplier
	end
	--大中小动员令加成
	score = score * cat
	--如果有參考來源則加成(上限10分)
	if args.refcheck == '1' then
		score = score + math.min(0.5 * refnum, 10)
	end
	--如果有有聲條目則加成
	if args.spokencheck == '1' then
		score = score + 0.15 * spokenlength / 1000
	end
	--如果有原創圖片條目則加成
	if args.piccheck == '1' then
		--原创图片总数量如果超过上限,尽可能地多保留特色原创图片 fpicnum
		if picnum + fpicnum > piclimit then
			if fpicnum > piclimit then
				fpicnum = piclimit
				picnum = 0
			else
				picnum = piclimit - fpicnum	
			end
		end
		score = score + (10 * (picnum + 2.5 * fpicnum)) ^ 0.7
		score = score + 0.3 * pictranslength ^ 0.7
	end
	--如果有原創影片則加成
	if args.videocheck == '1' then
		score = score + 7 * math.min(videolength, 45) ^ 0.3 - 6
	end
	--四舍五入到十分位(Lua 没有 math.round)
	score = math.floor(score * 10 + 0.5) / 10
	return score
end
return final_assessment