def to_bytes(self):
for tokens in self.tokens:<EOL><INDENT>assert len(tokens.shape) == <NUM_LIT:2>, tokens.shape<EOL><DEDENT>lengths = [len(tokens) for tokens in self.tokens]<EOL>msg = {<EOL>"<STR_LIT>": self.attrs,<EOL>"<STR_LIT>": numpy.vstack(self.tokens).tobytes("<STR_LIT:C>"),<EOL>"<STR_LIT>": numpy.vstack(self.spaces).tobytes("<STR_LIT:C>"),<EOL>"<STR_LIT>": numpy.asarray(lengths, dtype="<STR_LIT>").tobytes("<STR_LIT:C>"),<EOL>"<STR_LIT>": list(self.strings),<EOL>}<EOL>return gzip.compress(srsly.msgpack_dumps(msg))<EOL>
Serialize the binder's annotations into a byte string.