From c8b89e37a5ef638083129508a1ae0ffa629a0c2c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 21 Jul 2015 20:05:53 +0200 Subject: [PATCH] * Bug fix to faster huffman decoding --- spacy/serialize/huffman.pyx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spacy/serialize/huffman.pyx b/spacy/serialize/huffman.pyx index 5d42d1030..9715a0544 100644 --- a/spacy/serialize/huffman.pyx +++ b/spacy/serialize/huffman.pyx @@ -130,10 +130,8 @@ cdef class HuffmanCodec: if i_msg == n_msg: break i_byte += 1 - else: - raise Exception("Buffer exhausted at %d/%d symbols read." % (i_msg, len(msg))) - - + # as_bytes doesn't seek forward, so consume the number of bits we used + bits.seek(bits.i + (i_byte * 8) + i_bit) property strings: @cython.boundscheck(False)