| 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
|
|
|
16 |
if "Half QWERTY keyboard" :
|
|
|
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") :
|
|
|
29 |
navigation = features.get("Navigation")
|
|
|
30 |
if len(navigation) > 0 :
|
|
|
31 |
type = navigation[0]
|
|
|
32 |
if type == "5-way key" :
|
|
|
33 |
navigation_score = 4
|
|
|
34 |
elif type == "Trackpad" :
|
|
|
35 |
navigation_score = 6
|
|
|
36 |
elif type == "Optical Trackpad" :
|
|
|
37 |
navigation_score = 9
|
|
|
38 |
if type == "Touch Navigation" :
|
|
|
39 |
navigation_score = 8
|
|
|
40 |
if type == "Trackball" :
|
|
|
41 |
navigation_score = 5
|
|
|
42 |
if type == "Optical Joystick" :
|
|
|
43 |
navigation_score = 5
|
|
|
44 |
if type == "Optical Navikey" :
|
|
|
45 |
navigation_score = 5
|
|
|
46 |
|
|
|
47 |
if features.has_key("Touchscreen Type") :
|
|
|
48 |
touch_screen_type = features.get("Touchscreen Type")
|
|
|
49 |
if len(touch_screen_type) > 0 :
|
|
|
50 |
touch_screen_type = touch_screen_type[0]
|
|
|
51 |
if touch_screen_type == "Capacitive" :
|
|
|
52 |
touch_screen_score = 9
|
|
|
53 |
elif touch_screen_type == "Resistive" :
|
|
|
54 |
touch_screen_score = 6
|
|
|
55 |
|
|
|
56 |
print "type_score" + str(type_score)
|
|
|
57 |
print "navigation_score" + str(navigation_score)
|
|
|
58 |
print "touch_screen_score" + str(touch_screen_score)
|
|
|
59 |
|
|
|
60 |
if touch_screen_score == 0 :
|
|
|
61 |
score = (55*type_score + 45*navigation_score)/100
|
|
|
62 |
else :
|
|
|
63 |
score = (40*type_score + 30*navigation_score + 30*touch_screen_score)/100
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
return score
|