From 7eb244608229601a10cd651869400a4010ae492a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 26 Jul 2015 00:18:30 +0200 Subject: [PATCH] * Return empty lexeme on empty string --- spacy/vocab.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/vocab.pyx b/spacy/vocab.pyx index 0598860a1..3dfa1d658 100644 --- a/spacy/vocab.pyx +++ b/spacy/vocab.pyx @@ -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 = self._by_hash.get(key)