Subversion Repositories SmartDukaan

Rev

Rev 2302 | Rev 2656 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2302 Rev 2655
Line 6... Line 6...
6
    
6
    
7
    type_score = 0.0
7
    type_score = 0.0
8
    screen_size_score = 0.0
8
    screen_size_score = 0.0
9
    screen_resolution_score = 0.0
9
    screen_resolution_score = 0.0
10
    number_of_colors_score = 0.0
10
    number_of_colors_score = 0.0
-
 
11
    
-
 
12
    category = struct.has_key("category")
-
 
13
    max_screen_size = 5
-
 
14
    min_screen_size = 1.5
-
 
15
    max_resolution = 409920
-
 
16
    min_resolution = 16384
11
 
17
    
-
 
18
    if category == "Tablets":
-
 
19
        max_screen_size = 10
-
 
20
        min_screen_size = 5
-
 
21
        max_resolution = 1024000
-
 
22
        min_resolution = 200000
-
 
23
         
12
    if struct.has_key("features") :
24
    if struct.has_key("features") :
13
        features = struct.get("features")
25
        features = struct.get("features")
14
        
26
        
15
        # Screen Size : <=2 - 1, <=2.5 - 2, > 2.5 - 3
27
        # Screen Size : <=2 - 1, <=2.5 - 2, > 2.5 - 3
16
        if features.has_key("Screen size") :
28
        if features.has_key("Screen size") :
Line 19... Line 31...
19
            if len(ss) > 0 :
31
            if len(ss) > 0 :
20
                ss = ss[0]
32
                ss = ss[0]
21
                ss = float(ss)
33
                ss = float(ss)
22
                print "Screen Size=" + `ss`
34
                print "Screen Size=" + `ss`
23
                
35
                
24
                if  ss >= 5 :
36
                if  ss >= max_screen_size :
25
                    screen_size_score = 10
37
                    screen_size_score = 10
26
 
38
 
27
                elif  ss <= 1.5 :
39
                elif  ss <= min_screen_size :
28
                    screen_size_score = 0
40
                    screen_size_score = 0
29
 
41
 
30
                else :
42
                else :
31
                    screen_size_score = ((ss**2) - (1.5**2))/((5**2) - (1.5**2))*10
43
                    screen_size_score = ((ss**2) - (min_screen_size**2))/((max_screen_size**2) - (min_screen_size**2))*10
32
                
44
                
33
        # Resolution : 320x240 px - 1, 480x360 px - 2
45
        # Resolution : 320x240 px - 1, 480x360 px - 2
34
        if features.has_key("Resolution") :
46
        if features.has_key("Resolution") :
35
            res = features.get("Resolution")
47
            res = features.get("Resolution")
36
            
48
            
Line 39... Line 51...
39
                height = int(res[1])
51
                height = int(res[1])
40
                area = height * width
52
                area = height * width
41
                print "width=" + `width`
53
                print "width=" + `width`
42
                print "height=" + `height`
54
                print "height=" + `height`
43
                
55
                
44
                if  area < 16384 :
56
                if  area < min_resolution :
45
                    screen_resolution_score = 0
57
                    screen_resolution_score = 0
46
        
58
        
47
                elif  area >= 409920 :
59
                elif  area >= max_resolution :
48
                    screen_resolution_score = 10
60
                    screen_resolution_score = 10
49
                    
61
                    
50
                else :
62
                else :
51
                    screen_resolution_score = (area - 16384) / (409920 - 16384) * 10
63
                    screen_resolution_score = (area - min_resolution) / (max_resolution - min_resolution) * 10
52
                    
64
                    
53
        # Number of Colors : 64 K - 0.5, 256 K - 1, 16 M - 1.5, 4 B - 2
65
        # Number of Colors : 64 K - 0.5, 256 K - 1, 16 M - 1.5, 4 B - 2
54
        if features.has_key("Number of colors") :
66
        if features.has_key("Number of colors") :
55
            nfcs = features.get("Number of colors")
67
            nfcs = features.get("Number of colors")
56
            
68
            
Line 112... Line 124...
112
                    type_score = 6
124
                    type_score = 6
113
                elif type == "CSTN LCD" :
125
                elif type == "CSTN LCD" :
114
                    type_score = 4
126
                    type_score = 4
115
                elif type == "STN LCD" :
127
                elif type == "STN LCD" :
116
                    type_score = 2
128
                    type_score = 2
117
   
129
                
-
 
130
                if category == "Tablets":
-
 
131
                    if type == "TFT LCD" :
-
 
132
                        type_score = 8.5
118
 
133
 
119
 
134
 
120
 
135
 
121
    print "type_score" + str(type_score)
136
    print "type_score" + str(type_score)
122
    print "screen_size_score: " + str(screen_size_score)
137
    print "screen_size_score: " + str(screen_size_score)