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

Docs broken, unsure how to use this library. #118

Open
arunasank opened this issue Dec 2, 2021 · 0 comments
Open

Docs broken, unsure how to use this library. #118

arunasank opened this issue Dec 2, 2021 · 0 comments

Comments

@arunasank
Copy link

  • spacy_readability version:
  • Python version: 3.8.5
  • Operating System: Linux (Jupyter notebook)

Description

Just trying to use spacy_readability. The docs are outdated, and the init commands break.

What I Did

import spacy
from spacy_readability import Readability
nlp = spacy.load("en_core_web_sm")
nlp.add_pipe(Readability())

nltk.download('punkt')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-391-3e5e0b5647da> in <module>
     17 from spacy_readability import Readability
     18 nlp = spacy.load("en_core_web_sm")
---> 19 nlp.add_pipe(Readability())
     20 
     21 nltk.download('punkt')

~/.local/lib/python3.8/site-packages/spacy/language.py in add_pipe(self, factory_name, name, before, after, first, last, source, config, raw_config, validate)
    767             bad_val = repr(factory_name)
    768             err = Errors.E966.format(component=bad_val, name=name)
--> 769             raise ValueError(err)
    770         name = name if name is not None else factory_name
    771         if name in self.component_names:

ValueError: [E966] `nlp.add_pipe` now takes the string name of the registered component factory, not a callable component. Expected string, but got <spacy_readability.Readability object at 0x7f06e6ac7ee0> (name: 'None').

- If you created your component with `nlp.create_pipe('name')`: remove nlp.create_pipe and call `nlp.add_pipe('name')` instead.

- If you passed in a component like `TextCategorizer()`: call `nlp.add_pipe` with the string name instead, e.g. `nlp.add_pipe('textcat')`.

- If you're using a custom component: Add the decorator `@Language.component` (for function components) or `@Language.factory` (for class components / factories) to your custom component and assign it a name, e.g. `@Language.component('your_name')`. You can then run `nlp.add_pipe('your_name')` to add it to the pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant