mirror of https://github.com/explosion/spaCy.git
Make PhraseMatcher.vocab consistent with Matcher.vocab (closes #4373)
This commit is contained in:
parent
e7ddc6f662
commit
fec9433044
|
@ -9,7 +9,7 @@ from ..vocab cimport Vocab
|
||||||
|
|
||||||
|
|
||||||
cdef class PhraseMatcher:
|
cdef class PhraseMatcher:
|
||||||
cdef Vocab vocab
|
cdef readonly Vocab vocab
|
||||||
cdef attr_id_t attr
|
cdef attr_id_t attr
|
||||||
cdef object _callbacks
|
cdef object _callbacks
|
||||||
cdef object _docs
|
cdef object _docs
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# coding: utf8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from spacy.matcher import Matcher, PhraseMatcher
|
||||||
|
from spacy.vocab import Vocab
|
||||||
|
|
||||||
|
|
||||||
|
def test_issue4373():
|
||||||
|
"""Test that PhraseMatcher.vocab can be accessed (like Matcher.vocab)."""
|
||||||
|
matcher = Matcher(Vocab())
|
||||||
|
assert isinstance(matcher.vocab, Vocab)
|
||||||
|
matcher = PhraseMatcher(Vocab())
|
||||||
|
assert isinstance(matcher.vocab, Vocab)
|
Loading…
Reference in New Issue