Closed danielduckworth closed 5 years ago
Looks like I had an error in the example documentation. I have pushed a fix onto the master branch with the change. Here is a colab notebook with the updated example as well. https://colab.research.google.com/drive/1NVl5rb2GBCTE0aGEzNtlBroUbaExHkC2
Thanks for reporting this!
Hi @mholtzscher , I'm running into the same problem. The link to the colab notebook does not work anymore. Could you please share it again? Thank you, Roelien
For anyone who hits this in the future:
import spacy
from spacy_readability import Readability
nlp = spacy.load('en')
nlp.add_pipe(Readability())
doc = nlp("I am some really difficult text to read because I use obnoxiously large words.")
print(doc._.flesch_kincaid_grade_level)
print(doc._.flesch_kincaid_reading_ease)
print(doc._.dale_chall)
print(doc._.smog)
print(doc._.coleman_liau_index)
print(doc._.automated_readability_index)
print(doc._.forcast)
Hi,
Is this compatible with spacy v3? Now, you have to provide a name for nlp.add_pipe(). When I try running as per the documentation, I get the following error:
``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 0x000001997BCAC080> (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.```
So I guess it needs to be updated? Or am I using it wrong?
Description
I get the error: TypeError: init() takes 1 positional argument but 2 were given
What I Did