Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5173 amit.gupta 1
import utils
2
 
3
def getscore(struct):
4
 
5
    score = 0.0
6
 
7
    if struct.has_key('features'):
8
        features = struct.get('features')
9
        if features.has_key('Web cam'):
10
            if `features.get('Web cam')[0]`.find('VGA') > -1 or `features.get('Web cam')[0]`.find('0.3') > -1 or `features.get('Web cam')[0]`.find('1.3')> -1 :
11
                score += 20
12
            else :
13
                score += 30 
14
        if features.has_key('Pointing device'):
15
            score +=15.0
16
            if features.has_key('Pointing device_fft'):
17
                for fft in features.get('Pointing device_fft'):
18
                    fft = fft.encode()
19
                    if fft.find('multi') > -1 or fft.find('Multi') > -1:
20
                        if fft.find('touch') > -1 or fft.find('Touch')> -1:
21
                            score += 5.0
22
                            break
23
 
24
        if features.has_key('Built-in speaker'):
25
            score += 15.0
26
            if len(features.get('Built-in speaker')[0]) > -1:
27
                score += 5.0
28
        if features.has_key('Dedicated keys'):
29
            score += 10.0
30
        if features.has_key('Biometric security'):
31
            bio_score = len(features.get('Biometric security'))*10.0
32
            if bio_score > 20.0:
33
                bio_score = 20.0
34
            score += bio_score
35
 
36
    return score/10.0
37
 
38
 
39
print "expSlide=" + `expSlide`
40
 
41
struct = utils.contentModel2Struct(expSlide, categoryObj)
42
print "struct=" + `struct`
43
 
44
score = getscore(struct)