예제 #1
0
 def valuedecoder(self, v):
     if len(v) == _INT_SIZE:
         return (1.0, unpack_uint(v)[0], 1)
     elif len(v) == _terminfo_struct0.size:
         return _terminfo_struct0.unpack(v)
     elif len(v) == _terminfo_struct1.size:
         return _terminfo_struct1.unpack(v)
     else:
         return _terminfo_struct2.unpack(v)
예제 #2
0
 def decode_positions(self, valuestring):
     read = StringIO(valuestring).read
     freq = unpack_uint(read(_INT_SIZE))[0]
     position = 0
     positions = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         positions.append(position)
     return positions
예제 #3
0
 def decode_positions(self, valuestring):
     read = StringIO(valuestring).read
     freq = unpack_uint(read(_INT_SIZE))[0]
     position = 0
     positions = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         positions.append(position)
     return positions
예제 #4
0
 def decode_characters(self, valuestring):
     read = StringIO(valuestring).read
     freq = unpack_uint(read(_INT_SIZE))[0]
     position = 0
     endchar = 0
     posns_chars = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         startchar = endchar + read_varint(read)
         endchar = startchar + read_varint(read)
         posns_chars.append((position, startchar, endchar))
     return posns_chars
예제 #5
0
 def decode_characters(self, valuestring):
     read = StringIO(valuestring).read
     freq = unpack_uint(read(_INT_SIZE))[0]
     position = 0
     endchar = 0
     posns_chars = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         startchar = endchar + read_varint(read)
         endchar = startchar + read_varint(read)
         posns_chars.append((position, startchar, endchar))
     return posns_chars
예제 #6
0
    def decode_position_boosts(self, valuestring):
        f = StringIO(valuestring)
        read = f.read
        freq = unpack_uint(read(_INT_SIZE))[0]

        # Skip summed boost
        f.seek(_FLOAT_SIZE, 1)

        position = 0
        posns_boosts = []
        for _ in xrange(freq):
            position = read_varint(read) + position
            boost = byte_to_float(read(1))
            posns_boosts.append((position, boost))
        return posns_boosts
예제 #7
0
 def decode_position_boosts(self, valuestring):
     f = StringIO(valuestring)
     read = f.read
     freq = unpack_uint(read(_INT_SIZE))[0]
     
     # Skip summed boost
     f.seek(_FLOAT_SIZE, 1)
     
     position = 0
     posns_boosts = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         boost = byte_to_float(read(1))
         posns_boosts.append((position, boost))
     return posns_boosts
예제 #8
0
 def decode_positions(self, valuestring):
     f = StringIO(valuestring)
     read, seek = f.read, f.seek
     
     freq = unpack_uint(read(_INT_SIZE))[0]
     # Skip summed boost
     seek(_FLOAT_SIZE, 1)
     
     position = 0
     positions = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         # Skip boost
         seek(1, 1)
         positions.append(position)
     return positions
예제 #9
0
    def decode_positions(self, valuestring):
        f = StringIO(valuestring)
        read, seek = f.read, f.seek

        freq = unpack_uint(read(_INT_SIZE))[0]
        # Skip summed boost
        seek(_FLOAT_SIZE, 1)

        position = 0
        positions = []
        for _ in xrange(freq):
            position = read_varint(read) + position
            # Skip boost
            seek(1, 1)
            positions.append(position)
        return positions
예제 #10
0
    def decode_character_boosts(self, valuestring):
        f = StringIO(valuestring)
        read = f.read

        freq = unpack_uint(read(_INT_SIZE))[0]
        # Skip summed boost
        f.seek(_FLOAT_SIZE, 1)

        position = 0
        endchar = 0
        posns_chars = []
        for _ in xrange(freq):
            position = read_varint(read) + position
            startchar = endchar + read_varint(read)
            endchar = startchar + read_varint(read)
            boost = byte_to_float(read(1))
            posns_chars.append((position, startchar, endchar, boost))
        return posns_chars
예제 #11
0
 def decode_character_boosts(self, valuestring):
     f = StringIO(valuestring)
     read = f.read
     
     freq = unpack_uint(read(_INT_SIZE))[0]
     # Skip summed boost
     f.seek(_FLOAT_SIZE, 1)
     
     position = 0
     endchar = 0
     posns_chars = []
     for _ in xrange(freq):
         position = read_varint(read) + position
         startchar = endchar + read_varint(read)
         endchar = startchar + read_varint(read)
         boost = byte_to_float(read(1))
         posns_chars.append((position, startchar, endchar, boost))
     return posns_chars
예제 #12
0
 def decode_docboosts(self, valuestring):
     freq = unpack_uint(valuestring[:_INT_SIZE])[0]
     docboost = byte_to_float(valuestring[-1])
     return (freq, docboost)
예제 #13
0
 def get_uint(self, position):
     return unpack_uint(self.map[position:position + _INT_SIZE])[0]
예제 #14
0
 def read_uint(self):
     return unpack_uint(self.file.read(_INT_SIZE))[0]
예제 #15
0
 def read_uint(self):
     return unpack_uint(self.file.read(_INT_SIZE))[0]
예제 #16
0
 def decode_frequency(self, valuestring):
     return unpack_uint(valuestring)[0]
예제 #17
0
 def decode_weight(self, valuestring):
     freq = unpack_uint(valuestring[:_INT_SIZE])[0]
     docboost = byte_to_float(valuestring[-1])
     return freq * docboost * self.field_boost
예제 #18
0
 def get_uint(self, position):
     return unpack_uint(self.get(position, _INT_SIZE))[0]
예제 #19
0
 def decode_frequency(self, valuestring):
     return unpack_uint(valuestring[:_INT_SIZE])[0]
예제 #20
0
 def decode_weight(self, valuestring):
     freq = unpack_uint(valuestring)[0]
     return freq * self.field_boost
예제 #21
0
 def decode_weight(self, valuestring):
     freq = unpack_uint(valuestring)[0]
     return freq * self.field_boost
예제 #22
0
 def decode_frequency(self, valuestring):
     return unpack_uint(valuestring)[0]
예제 #23
0
파일: formats.py 프로젝트: ljarufe/mp100
 def decode_docboosts(self, valuestring):
     freq = unpack_uint(valuestring[:_INT_SIZE])[0]
     docboost = byte_to_float(valuestring[-1])
     return (freq, docboost)
예제 #24
0
 def decode_frequency(self, valuestring):
     return unpack_uint(valuestring[:_INT_SIZE])[0]
예제 #25
0
파일: formats.py 프로젝트: ljarufe/mp100
 def decode_weight(self, valuestring):
     freq = unpack_uint(valuestring[:_INT_SIZE])[0]
     docboost = byte_to_float(valuestring[-1])
     return freq * docboost * self.field_boost
예제 #26
0
 def get_uint(self, position):
     return unpack_uint(self.map[position:position + _INT_SIZE])[0]
예제 #27
0
 def get_uint(self, position):
     return unpack_uint(self.get(position, _INT_SIZE))[0]