chartbeat-labs / textacy

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

Fix import for TextStats #331

Closed austinjp closed 3 years ago

austinjp commented 3 years ago

Description

TextStats is documented as being directly with the root package textacy, but in my installation (version 0.11.0 installed via pip and Python 3.8) it's actually within textacy.text_stats.

Motivation and Context

Accurate quickstart documentation.

How Has This Been Tested?

Tested only in a REPL (ptpython):

>>> import textacy

>>> doc = textacy.make_spacy_doc("Hello, world!", lang="en_core_sci_md")

>>> ts = textacy.TextStats(doc)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'textacy' has no attribute 'TextStats'

module 'textacy' has no attribute 'TextStats'

>>> ts = textacy.text_stats.TextStats(doc)

>>> ts.n_words
2

>>>

Screenshots (if appropriate):

Types of changes

Checklist:

bdewilde commented 3 years ago

Hi @austinjp , thanks for the report! The current behavior (requiring from textacy import text_stats) is an intentional change in v0.11, but it looks like I forgot to update corresponding quickstart documentation. (I punted on changing it for this release, and instead just added two new tutorials — this was my bad 🙂).

Your change looks good to me. Thanks again!