diff --git a/spacy/serialize/packer.pyx b/spacy/serialize/packer.pyx index 36fe5cf2c..17d687669 100644 --- a/spacy/serialize/packer.pyx +++ b/spacy/serialize/packer.pyx @@ -7,9 +7,6 @@ from libc.math cimport exp as c_exp from libcpp.queue cimport priority_queue from libcpp.pair cimport pair -from ..structs cimport UniStr -from ..strings cimport slice_unicode - from cymem.cymem cimport Address, Pool from preshed.maps cimport PreshMap from preshed.counter cimport PreshCounter @@ -175,14 +172,13 @@ cdef class Packer: cdef Doc tokens = Doc(self.vocab) cdef int start = 0 cdef bint is_spacy - cdef UniStr span cdef int length = len(string) cdef int i = 0 cdef bint is_end_token for is_end_token in bits: if is_end_token: - slice_unicode(&span, string, start, i+1) - lex = self.vocab.get(tokens.mem, &span) + span = string[start:i+1] + lex = self.vocab.get(tokens.mem, span) is_spacy = (i+1) < length and string[i+1] == u' ' tokens.push_back(lex, is_spacy) start = i + 1 + is_spacy diff --git a/spacy/structs.pxd b/spacy/structs.pxd index 4c43cbf92..f3095df51 100644 --- a/spacy/structs.pxd +++ b/spacy/structs.pxd @@ -78,9 +78,3 @@ cdef struct TokenC: int ent_iob int ent_type - - -cdef struct UniStr: - Py_UNICODE* chars - size_t n - hash_t key