mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-25 00:34:20 +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
|
||||
else:
|
||||
self._add_lex_to_vocab(key, lex)
|
||||
assert lex != NULL, string
|
||||
return lex
|
||||
|
||||
cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL:
|
||||
|
@ -124,6 +125,7 @@ cdef class Vocab:
|
|||
lex.id = 0
|
||||
else:
|
||||
self._add_lex_to_vocab(hash_string(string), lex)
|
||||
assert lex != NULL, orth
|
||||
return lex
|
||||
|
||||
cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1:
|
||||
|
|
Loading…
Reference in New Issue
Block a user