Subversion Repositories SmartDukaan

Rev

Rev 2547 | Rev 2655 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1915 rajveer 1
def getscore(struct) :
2
 
3
    score = 0.0
4
    type_score = 0.0
5
    navigation_score = 0.0
6
    touch_screen_score = 0.0
7
 
8
    if struct.has_key("features") :
9
        features = struct.get("features")
10
        if features.has_key("Type") :
11
            type = features.get("Type")
12
            if len(type) > 0 :
13
 
14
                if "T9 keyboard" in type:
15
                    type_score = 5.0
2547 rajveer 16
                if "Half QWERTY keyboard" in type:
1915 rajveer 17
                    type_score = 6.0
18
                if "Touchscreen T9 keyboard" in type :
19
                    type_score = 7.0
20
                if "QWERTY keyboard" in type:
21
                    type_score = 8.0
22
                if "Touchscreen QWERTY keyboard" in type:
23
                    if "QWERTY keyboard" in type:
24
                        type_score = 10.0
25
                    else:
26
                        type_score = 9.0
27
 
28
        if features.has_key("Navigation") :
2556 rajveer 29
            type = features.get("Navigation")
30
            if len(type) > 0 :
31
                if "5-way key" in type:
1915 rajveer 32
                    navigation_score = 4
2556 rajveer 33
                if "Trackball"  in type:
34
                    navigation_score = 5
35
                if "Optical joystick" in type:
36
                    navigation_score = 5
37
                if "Optical navi key" in type:
38
                    navigation_score = 5
39
                if "Trackpad" in type:
1915 rajveer 40
                    navigation_score = 6
2556 rajveer 41
                if "Optical trackpad" in type:
1915 rajveer 42
                    navigation_score = 9
2556 rajveer 43
                if "Touch navigation" in type :
1915 rajveer 44
                    navigation_score = 8
2556 rajveer 45
                    if "Trackpad" in type:
46
                        navigation_score = 9.5
47
                    if "Optical trackpad" in type:
48
                        navigation_score = 10
49
 
1915 rajveer 50
 
2556 rajveer 51
        if features.has_key("Touchscreen type") :
52
            touch_screen_type = features.get("Touchscreen type")
1915 rajveer 53
            if len(touch_screen_type) > 0 :
54
                touch_screen_type = touch_screen_type[0]
2556 rajveer 55
                if touch_screen_type == "Capacitive touchscreen" :
1915 rajveer 56
                    touch_screen_score = 9
2556 rajveer 57
                elif touch_screen_type == "Resistive touchscreen" :
1915 rajveer 58
                    touch_screen_score = 6
59
 
60
    print "type_score" + str(type_score)
61
    print "navigation_score" + str(navigation_score)
62
    print "touch_screen_score" + str(touch_screen_score)
63
 
64
    if touch_screen_score == 0 :
65
        score = (55*type_score + 45*navigation_score)/100    
66
    else :
67
        score = (40*type_score + 30*navigation_score + 30*touch_screen_score)/100
68
 
69
 
70
 
71
    return score