Rev 4569 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
import utilsdef getMaxValFromDict(dictionary):max = Nonefor key, val in dictionary.iteritems():if max is not None or max < val: max = valreturn max * 1.0def getBenchmarkScore(model):processor_benchmarks = {'Intel 2630QM 2GHz': 6337,'Intel 2430M 2.4GHz': 3483,'Intel 2410M 2.3GHz': 3362,'Intel 2330M 2.2GHz': 2727,'Intel 2310M 2.1GHz': 2623,'Intel 370M 2.4GHz': 2218,'Intel B950 2.1GHz': 2018,'Intel B940 2GHz': 1904,'Intel T4500 2.3GHz': 1545,'Intel T6750 2.1GHz': 1349,'Intel 380UM 1.33GHz': 1301,'AMD Neo-K235': 782,'AMD E 350': 724,'Intel N570 1.66GHz': 646,'Intel N455 1.66GHz': 321}max_score = getMaxValFromDict(processor_benchmarks)score = 0.0for processor, benchmark_score in processor_benchmarks.iteritems():if(processor.lower().find(model.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)