mirror of https://github.com/explosion/spaCy.git
Fix internal keyword add/remove for numpy arrays
This commit is contained in:
parent
0d851db6d9
commit
3a4e1f5ca7
|
@ -122,6 +122,7 @@ cdef class PhraseMatcher:
|
||||||
break
|
break
|
||||||
# otherwise simply remove the key
|
# otherwise simply remove the key
|
||||||
else:
|
else:
|
||||||
|
if key in current_dict[self._terminal]:
|
||||||
current_dict[self._terminal].remove(key)
|
current_dict[self._terminal].remove(key)
|
||||||
|
|
||||||
del self._keywords[key]
|
del self._keywords[key]
|
||||||
|
@ -159,7 +160,6 @@ cdef class PhraseMatcher:
|
||||||
keyword = self._convert_to_array(doc)
|
keyword = self._convert_to_array(doc)
|
||||||
# keep track of keywords per key to make remove easier
|
# keep track of keywords per key to make remove easier
|
||||||
# (would use a set, but can't hash numpy arrays)
|
# (would use a set, but can't hash numpy arrays)
|
||||||
if keyword not in self._keywords[key]:
|
|
||||||
self._keywords[key].append(keyword)
|
self._keywords[key].append(keyword)
|
||||||
current_dict = self.keyword_trie_dict
|
current_dict = self.keyword_trie_dict
|
||||||
for token in keyword:
|
for token in keyword:
|
||||||
|
|
Loading…
Reference in New Issue