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

phrasematcher attr='LOWER' fails initialization when used in a pipeline #13489

Closed
larrymccutchan opened this issue May 14, 2024 · 3 comments
Closed

Comments

@larrymccutchan
Copy link

How to reproduce the behaviour

Using the example provided in https://spacy.io/usage/processing-pipelines#custom-components-attributes for RESCountriesComponents.

Update the matcher to the following:
self.matcher = PhraseMatcher(nlp.vocab, attr="LOWER") # set the LOWER attrib instead of ORTH

The failure is the following:
ValueError: [E109] Component 'rest_countries' could not be run. Did you forget to call initialize()?
File /databricks/python/lib/python3.10/site-packages/spacy/language.py:1049, in Language.call(self, text, disable, component_cfg)
1048 try:
-> 1049 doc = proc(doc, **component_cfg.get(name, {})) # type: ignore[call-arg]
1050 except KeyError as e:
1051 # This typically happens if a component is not initialized
File /databricks/python/lib/python3.10/site-packages/spacy/language.py:1052, in Language.call(self, text, disable, component_cfg)
1049 doc = proc(doc, **component_cfg.get(name, {})) # type: ignore[call-arg]
1050 except KeyError as e:
1051 # This typically happens if a component is not initialized
-> 1052 raise ValueError(Errors.E109.format(name=name)) from e
1053 except Exception as e:
1054 error_handler(name, proc, [doc], e)

Your Environment

spaCy version: 3.7.2

  • Platform: Linux-5.15.0-1058-aws-x86_64-with-glibc2.35
  • Python version: 3.10.12
@larrymccutchan
Copy link
Author

Please close this. I figured out the problem and it was NOT concerning the attr="LOWER" but was another bug in the code I was using.

@svlandeg
Copy link
Member

Thanks for reporting back! I'll go ahead and close this 🙏

Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants