From 3ff09614e0f6fdf4a9badb0ddc75e644df892340 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 30 Sep 2016 19:56:48 +0200 Subject: [PATCH] Changes to matcher.pyx for new StringStore scheme --- spacy/matcher.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index 3307eb864..fda828763 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -153,7 +153,7 @@ def _convert_strings(token_specs, string_store): if isinstance(attr, basestring): attr = attrs.IDS.get(attr.upper()) if isinstance(value, basestring): - value = string_store[value] + value = string_store.intern(value) if isinstance(value, bool): value = int(value) if attr is not None: @@ -221,9 +221,9 @@ cdef class Matcher: def add(self, entity_key, etype, attrs, specs): self._patterns[entity_key] = (etype, dict(attrs), list(specs)) if isinstance(entity_key, basestring): - entity_key = self.vocab.strings[entity_key] + entity_key = self.vocab.strings.intern(entity_key) if isinstance(etype, basestring): - etype = self.vocab.strings[etype] + etype = self.vocab.strings.intern(etype) elif etype is None: etype = -1 # TODO: Do something more clever about multiple patterns for single