mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-15 11:00:34 +03:00
Fix how match ID hash is stored/added
This commit is contained in:
parent
39540ed1ce
commit
d4141302b6
|
@ -15,7 +15,6 @@ import numpy as np
|
||||||
|
|
||||||
from ..attrs cimport ORTH, POS, TAG, DEP, LEMMA, attr_id_t
|
from ..attrs cimport ORTH, POS, TAG, DEP, LEMMA, attr_id_t
|
||||||
from ..vocab cimport Vocab
|
from ..vocab cimport Vocab
|
||||||
from ..strings cimport hash_string
|
|
||||||
from ..tokens.doc cimport Doc, get_token_attr
|
from ..tokens.doc cimport Doc, get_token_attr
|
||||||
|
|
||||||
from ._schemas import TOKEN_PATTERN_SCHEMA
|
from ._schemas import TOKEN_PATTERN_SCHEMA
|
||||||
|
@ -178,7 +177,7 @@ cdef class PhraseMatcher:
|
||||||
DOCS: https://spacy.io/api/phrasematcher#add
|
DOCS: https://spacy.io/api/phrasematcher#add
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_ = self.vocab[key]
|
_ = self.vocab.strings[key]
|
||||||
self._callbacks[key] = on_match
|
self._callbacks[key] = on_match
|
||||||
self._keywords.setdefault(key, [])
|
self._keywords.setdefault(key, [])
|
||||||
self._docs.setdefault(key, set())
|
self._docs.setdefault(key, set())
|
||||||
|
@ -219,7 +218,7 @@ cdef class PhraseMatcher:
|
||||||
map_init(self.mem, internal_node, 8)
|
map_init(self.mem, internal_node, 8)
|
||||||
map_set(self.mem, current_node, self._terminal_node, internal_node)
|
map_set(self.mem, current_node, self._terminal_node, internal_node)
|
||||||
result.value = internal_node
|
result.value = internal_node
|
||||||
map_set(self.mem, <MapStruct*>result.value, hash_string(key), NULL)
|
map_set(self.mem, <MapStruct*>result.value, self.vocab.strings[key], NULL)
|
||||||
|
|
||||||
def __call__(self, doc):
|
def __call__(self, doc):
|
||||||
"""Find all sequences matching the supplied patterns on the `Doc`.
|
"""Find all sequences matching the supplied patterns on the `Doc`.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user