chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.22k stars 250 forks source link

make_spacy_doc() missing 1 required positional argument: 'lang' #334

Closed scarroll32 closed 3 years ago

scarroll32 commented 3 years ago

what's wrong?

When following the documentation on text_stats I am getting an error about a missing argument.

Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import textacy
>>> from textacy import datasets, text_stats
>>> text = next(textacy.datasets.CapitolWords().texts(limit=1))
>>> doc = textacy.make_spacy_doc(text)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: make_spacy_doc() missing 1 required positional argument: 'lang'

relevant page or section

https://textacy.readthedocs.io/en/latest/api_reference/text_stats.html#module-textacy.text_stats.api

How to fix

>>> import textacy
>>> from textacy import datasets, text_stats
>>> text = next(textacy.datasets.CapitolWords().texts(limit=1))
>>> doc = textacy.make_spacy_doc(text, lang='en_core_web_md')
>>> ts = textacy.text_stats.TextStats(doc)
>>> ts.n_words
137
>>> ts.n_unique_words
81
>>> ts.entropy
6.02267943673824
>>> ts.flesch_kincaid_grade_level
9.176341240875914
>>> ts.flesch_reading_ease
59.77429288321167

I'm happy to make a PR on this, but it is this the correct approach or am I doing something wrong here?

bdewilde commented 3 years ago

Hey @seanfcarroll , thanks for catching this! I made so many changes for v0.11, some docs were bound to fall through the cracks... I'll fix it, no problem.