Rev 323 | Rev 2547 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
def getscore(struct) :score = 0.0type_score = 0.0navigation_score = 0.0touch_screen_score = 0.0if struct.has_key("features") :features = struct.get("features")if features.has_key("Type") :type = features.get("Type")if len(type) > 0 :if "T9 keyboard" in type:type_score = 5.0if "Half QWERTY keyboard" :type_score = 6.0if "Touchscreen T9 keyboard" in type :type_score = 7.0if "QWERTY keyboard" in type:type_score = 8.0if "Touchscreen QWERTY keyboard" in type:if "QWERTY keyboard" in type:type_score = 10.0else:type_score = 9.0if features.has_key("Navigation") :navigation = features.get("Navigation")if len(navigation) > 0 :type = navigation[0]if type == "5-way key" :navigation_score = 4elif type == "Trackpad" :navigation_score = 6elif type == "Optical Trackpad" :navigation_score = 9if type == "Touch Navigation" :navigation_score = 8if type == "Trackball" :navigation_score = 5if type == "Optical Joystick" :navigation_score = 5if type == "Optical Navikey" :navigation_score = 5if features.has_key("Touchscreen Type") :touch_screen_type = features.get("Touchscreen Type")if len(touch_screen_type) > 0 :touch_screen_type = touch_screen_type[0]if touch_screen_type == "Capacitive" :touch_screen_score = 9elif touch_screen_type == "Resistive" :touch_screen_score = 6print "type_score" + str(type_score)print "navigation_score" + str(navigation_score)print "touch_screen_score" + str(touch_screen_score)if touch_screen_score == 0 :score = (55*type_score + 45*navigation_score)/100else :score = (40*type_score + 30*navigation_score + 30*touch_screen_score)/100return score