Rev 323 | Rev 1936 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
def getscore(struct):score = 0.0weight_score = 0.0thickness_score = 0.0if struct.has_key("features") :features = struct.get("features")# Weight : >250-10, <=60-10, others linearif features.has_key("Weight") :weight = features.get("Weight")if len(weight) > 0 :weight = float(weight[0])print "weight=" + `weight`if weight > 250 :weight_score = 0elif weight <= 60 :weight_score = 10else :weight_score = 10 - (weight - 60) / (250 - 60) * 10# Size : Thickness <=10-4, <=12-3, <=14-2, >14-1if features.has_key("Size") :size = features.get("Size")if len(size) > 2 :thickness = float(size[2])print "thickness=" + `thickness`if thickness <= 9 :thickness_score = 10elif thickness > 20 :thickness_score = 0else :thickness_score = 10 - (thickness - 9) / (20 - 9)score = (weight_score*50 + thickness_score*50)/100return score