From 7e04c22f8feb2f71bb417ef87887a5654496a09e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 3 Dec 2014 15:58:17 +1100 Subject: [PATCH] * const added to Lexicon interface. Seems to work. --- spacy/lang.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spacy/lang.pyx b/spacy/lang.pyx index 8d4ea7802..9013de9d0 100644 --- a/spacy/lang.pyx +++ b/spacy/lang.pyx @@ -296,8 +296,10 @@ cdef class Lexicon: def __setitem__(self, unicode uni_string, dict props): cdef UniStr s slice_unicode(&s, uni_string, 0, len(uni_string)) - cdef const Lexeme* lex = self.get(&s) - self.lexemes[lex.id][0] = lexeme_init(lex.id, s.chars[:s.n], s.key, self.strings, props) + # Cast through the const here, since we're allowed to change our own + # Lexemes. + lex = self.get(&s) + lex[0] = lexeme_init(lex.id, s.chars[:s.n], s.key, self.strings, props) def dump(self, loc): if path.exists(loc):