* Return empty lexeme on empty string

This commit is contained in:
Matthew Honnibal 2015-07-26 00:18:30 +02:00
parent 1b5d1da2a7
commit 7eb2446082

View File

@ -82,6 +82,8 @@ cdef class Vocab:
'''Get a pointer to a LexemeC from the lexicon, creating a new Lexeme
if necessary, using memory acquired from the given pool. If the pool
is the lexicon's own memory, the lexeme is saved in the lexicon.'''
if string == u'':
return &EMPTY_LEXEME
cdef LexemeC* lex
cdef hash_t key = hash_string(string)
lex = <LexemeC*>self._by_hash.get(key)