mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 01:04:34 +03:00
* Assert against null pointer exceptions in vocab
This commit is contained in:
parent
2b5cde87fd
commit
fc268f03eb
|
@ -101,6 +101,7 @@ cdef class Vocab:
|
||||||
lex.id = 0
|
lex.id = 0
|
||||||
else:
|
else:
|
||||||
self._add_lex_to_vocab(key, lex)
|
self._add_lex_to_vocab(key, lex)
|
||||||
|
assert lex != NULL, string
|
||||||
return lex
|
return lex
|
||||||
|
|
||||||
cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL:
|
cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL:
|
||||||
|
@ -124,6 +125,7 @@ cdef class Vocab:
|
||||||
lex.id = 0
|
lex.id = 0
|
||||||
else:
|
else:
|
||||||
self._add_lex_to_vocab(hash_string(string), lex)
|
self._add_lex_to_vocab(hash_string(string), lex)
|
||||||
|
assert lex != NULL, orth
|
||||||
return lex
|
return lex
|
||||||
|
|
||||||
cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1:
|
cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user