Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access PhraseMatcher.vocab though can access Matcher.vocab #4373

Closed
tamuhey opened this issue Oct 4, 2019 · 2 comments
Closed

Cannot access PhraseMatcher.vocab though can access Matcher.vocab #4373

tamuhey opened this issue Oct 4, 2019 · 2 comments
Labels
enhancement Feature requests and improvements feat / matcher Feature: Token, phrase and dependency matcher

Comments

@tamuhey
Copy link
Contributor

tamuhey commented Oct 4, 2019

How to reproduce the behaviour

Matcher.vocab can be accessed.

>>> from spacy.matcher import Matcher
>>> from spacy.vocab import Vocab
>>> matcher = Matcher(Vocab())
>>> matcher.vocab
<spacy.vocab.Vocab at 0x11ac06ec8>

However, PhraseMatcher.vocab cannot be accessed.

from spacy.matcher import PhraseMatcher
from spacy.vocab import Vocab
matcher = PhraseMatcher(Vocab())
matcher.vocab
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-21b52467d217> in <module>
      2 from spacy.vocab import Vocab
      3 matcher = PhraseMatcher(Vocab())
----> 4 matcher.vocab

AttributeError: 'spacy.matcher.phrasematcher.PhraseMatcher' object has no attribute 'vocab'

PhraseMatcher.vocab should be accessed because match_id can be decoded from the vocab.

Your Environment

  • Operating System: Mac OS
  • Python Version Used: 3.7.3
  • spaCy Version Used: master(e7ddc6f)
@ines
Copy link
Member

ines commented Oct 4, 2019

Good point – we might as well make this consistent. Fixing!

@ines ines added feat / matcher Feature: Token, phrase and dependency matcher enhancement Feature requests and improvements labels Oct 4, 2019
@ines ines closed this as completed in fec9433 Oct 4, 2019
@lock
Copy link

lock bot commented Nov 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Feature requests and improvements feat / matcher Feature: Token, phrase and dependency matcher
Projects
None yet
Development

No branches or pull requests

2 participants