Subversion Repositories SmartDukaan

Rev

Rev 5207 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4036 varun.gupt 1
import utils
2
 
3
def getMaxValFromDict(dictionary):
4
 
5
    max = None
6
 
7
    for key, val in dictionary.iteritems():
4569 varun.gupt 8
        if max is None or max < val:    max = val
4036 varun.gupt 9
 
10
    return max * 1.0
11
 
12
def getBenchmarkScore(model):
13
    processor_benchmarks = {
5173 amit.gupta 14
        "2310M" :    2619.0,
5207 amit.gupta 15
        "2330M" :    2729.0,
5173 amit.gupta 16
        "2350M" :    2932.0,
17
        "2410M" :    3362.0,
5205 amit.gupta 18
        "2430M" :    3456.0,
19
        "2450M" :    3573.0,
20
        "2467M" :    2413.0,
21
        "2557M" :    2601.0,
5173 amit.gupta 22
        "2630QM" :    6345.0,
23
        "2640M" :    4065.0,
24
        "2670QM" :    6811.0,
25
        "2720QM" :    6973.0,
26
        "2760QM" :    7595.0,
27
        "370M" :    2238.0,
28
        "380M" :    2328.0,
5205 amit.gupta 29
        "380UM" :    1317.0,
5173 amit.gupta 30
        "3400M" :    2976.0,
31
        "A6-3400M" :    2976.0,
32
        "AMD C60" :    565.0,
33
        "C60" :    565.0,
34
        "B800" :    1365.0,
35
        "B940" :    1880.0,
36
        "B950" :    1959.0,
37
        "B960" :    2090.0,
38
        "E-300" :    597.0,
39
        "E-350" :    727.0,
40
        "E-450" :    743.0,
41
        "2435M" :    3336.0,
42
        "2367M" :    1844.0,
43
        "i3-2367M" :    1844.0,
44
        "N2600" :    590.0,
45
        "N2800" :    723.0,
46
        "N455" :    320.0,
47
        "N550" :    569.0,
48
        "N570" :    639.0,
49
        "K325" :    780.0,
50
        "Neo K325" :    780.0,
51
        "P6200" :    1663.0,
52
        "T4500" :    1575.0,
6732 amit.gupta 53
        "T6570" :    1345.0,
54
        "T30"   :    1345.0   
4036 varun.gupt 55
    }
56
    max_score = getMaxValFromDict(processor_benchmarks)
5205 amit.gupta 57
    score = 0.0   
4036 varun.gupt 58
    for processor, benchmark_score in processor_benchmarks.iteritems():
5205 amit.gupta 59
        if(model.lower().find((processor.lower())) > -1):
5204 amit.gupta 60
            score = benchmark_score
4036 varun.gupt 61
 
62
    return (score * 10.0) / max_score
63
 
64
def getChipsetScore(chipset):
65
    chipset_scores = {
66
            'Intel HM65': 10,
67
            'Intel HM 57': 9.5,
68
            'Intel HM55': 9,
69
            'AMD M888G': 8.5,
70
            'Intel 45': 8,
71
            'Intel NM10': 7
72
    }
73
    for chipset_name, score in chipset_scores.iteritems():
74
        if chipset_name.lower().find(chipset) > -1 or chipset.find(chipset_name.lower()) > -1: return score
75
 
76
 
77
def getscore(struct):
78
    score = 0.0
79
    model_score = 0.0
80
 
81
    if struct.has_key('features'):
82
        features = struct.get('features')
83
 
84
        if features.has_key('Processor model'):
85
            model = features.get('Processor model')
86
            model_score = getBenchmarkScore(str(model[0]))
87
    return model_score
4569 varun.gupt 88
 
4036 varun.gupt 89
print "expSlide=" + `expSlide`
90
 
91
struct = utils.contentModel2Struct(expSlide, categoryObj)
92
print "struct=" + `struct`
93
 
94
score = getscore(struct)