def load_tsv_file(self, fl): t0 = time() for line in open(fl, "rb"): bs = line.strip().split('\t') b = Bookmark() b.url = bs[0] b.title = bs[1] b.tags = bs[2] self.add_bookmark(b) t1 = time() print "\n*Indexed file in: %.2f seconds*" % (t1-t0)
def deserialize(self, b_str): mbuf = TMemoryBuffer(b_str) mbuf_protocol = TBinaryProtocol(mbuf) b = Bookmark() b.read(mbuf_protocol) return b