mirror of https://github.com/explosion/spaCy.git
* Fix bug in refactored StringStore.__getitem__
This commit is contained in:
parent
14097311ae
commit
71b009e323
|
@ -5,6 +5,7 @@ import codecs
|
||||||
|
|
||||||
SEPARATOR = '\n|-SEP-|\n'
|
SEPARATOR = '\n|-SEP-|\n'
|
||||||
|
|
||||||
|
|
||||||
cdef class StringStore:
|
cdef class StringStore:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.mem = Pool()
|
self.mem = Pool()
|
||||||
|
@ -20,7 +21,7 @@ cdef class StringStore:
|
||||||
def __getitem__(self, object string_or_id):
|
def __getitem__(self, object string_or_id):
|
||||||
cdef bytes byte_string
|
cdef bytes byte_string
|
||||||
cdef Utf8Str* utf8str
|
cdef Utf8Str* utf8str
|
||||||
if isinstance(string_or_id, int):
|
if isinstance(string_or_id, int) or isinstance(string_or_id, long):
|
||||||
if string_or_id < 1 or string_or_id >= self.size:
|
if string_or_id < 1 or string_or_id >= self.size:
|
||||||
raise IndexError(string_or_id)
|
raise IndexError(string_or_id)
|
||||||
utf8str = &self.strings[<int>string_or_id]
|
utf8str = &self.strings[<int>string_or_id]
|
||||||
|
|
Loading…
Reference in New Issue