Beispiel #1
0
    def add_document(self, docID, wordList):
        self.socket.send(config.COMMAND_ADD_DOC)
        self.socket.send(config.pack_docID(docID))
        self.socket.send(struct.pack('I', len(wordList)))
        self.socket.send(struct.pack('I', sum(word.weight for word in wordList)))

        for word in wordList:
            self.socket.send(config.pack_word(word) + struct.pack('B', word.weight))
Beispiel #2
0
 def send(self, socket):
     socket.send(config.QNODE_KW)
     socket.send(config.pack_word(self.word))
Beispiel #3
0
 def send(self, socket):
     socket.send(config.QNODE_KW)
     socket.send(config.pack_word(self.word))