Make PhraseMatcher.vocab consistent with Matcher.vocab (closes #4373)

This commit is contained in:
Ines Montani 2019-10-04 12:18:41 +02:00
parent e7ddc6f662
commit fec9433044
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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)