From 815bda201d9bf717d9c88e787776af4373e3bc37 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 22 Jul 2015 13:39:17 +0200 Subject: [PATCH] * Remove UniStr struct --- spacy/serialize/packer.pyx | 8 ++------ spacy/structs.pxd | 6 ------ 2 files changed, 2 insertions(+), 12 deletions(-) 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