Rev 5207 | Blame | Compare with Previous | Last modification | View Log | RSS feed
import utilsdef getMaxValFromDict(dictionary):max = Nonefor key, val in dictionary.iteritems():if max is None or max < val: max = valreturn max * 1.0def getBenchmarkScore(model):processor_benchmarks = {"2310M" : 2619.0,"2330M" : 2729.0,"2350M" : 2932.0,"2410M" : 3362.0,"2430M" : 3456.0,"2450M" : 3573.0,"2467M" : 2413.0,"2557M" : 2601.0,"2630QM" : 6345.0,"2640M" : 4065.0,"2670QM" : 6811.0,"2720QM" : 6973.0,"2760QM" : 7595.0,"370M" : 2238.0,"380M" : 2328.0,"380UM" : 1317.0,"3400M" : 2976.0,"A6-3400M" : 2976.0,"AMD C60" : 565.0,"C60" : 565.0,"B800" : 1365.0,"B940" : 1880.0,"B950" : 1959.0,"B960" : 2090.0,"E-300" : 597.0,"E-350" : 727.0,"E-450" : 743.0,"2435M" : 3336.0,"2367M" : 1844.0,"i3-2367M" : 1844.0,"N2600" : 590.0,"N2800" : 723.0,"N455" : 320.0,"N550" : 569.0,"N570" : 639.0,"K325" : 780.0,"Neo K325" : 780.0,"P6200" : 1663.0,"T4500" : 1575.0,"T6570" : 1345.0,"T30" : 1345.0}max_score = getMaxValFromDict(processor_benchmarks)score = 0.0for processor, benchmark_score in processor_benchmarks.iteritems():if(model.lower().find((processor.lower())) > -1):score = benchmark_scorereturn (score * 10.0) / max_scoredef getChipsetScore(chipset):chipset_scores = {'Intel HM65': 10,'Intel HM 57': 9.5,'Intel HM55': 9,'AMD M888G': 8.5,'Intel 45': 8,'Intel NM10': 7}for chipset_name, score in chipset_scores.iteritems():if chipset_name.lower().find(chipset) > -1 or chipset.find(chipset_name.lower()) > -1: return scoredef getscore(struct):score = 0.0model_score = 0.0if struct.has_key('features'):features = struct.get('features')if features.has_key('Processor model'):model = features.get('Processor model')model_score = getBenchmarkScore(str(model[0]))return model_scoreprint "expSlide=" + `expSlide`struct = utils.contentModel2Struct(expSlide, categoryObj)print "struct=" + `struct`score = getscore(struct)