class_docstr: Class to compute a variety of basic, readability, morphological, and lexical diversity
  statistics for a given document.
  
  .. code-block:: pycon
  
      >>> text = next(textacy.datasets.CapitolWords().texts(limit=1))
      >>> doc = textacy.make_spacy_doc(text, lang="en_core_web_sm")
      >>> ts = textacy.text_stats.TextStats(doc)
      >>> ts.n_words
      137
      >>> ts.n_unique_words
      81
      >>> ts.entropy
      6.02267943673824
      >>> ts.readability("flesch-kincaid-grade-level")
      11.40259124087591
      >>> ts.diversity("ttr")
      0.5912408759124088
  
  Some readability stats vary by language or are designed for use with
  specific languages:
  
  .. code-block:: pycon
  
      >>> text = (
      ...     "Muchos años después, frente al pelotón de fusilamiento, "
      ...     "el coronel Aureliano Buendía había de recordar aquella tarde remota "
      ...     "en que su padre lo llevó a conocer el hielo."
      ... )
      >>> doc = textacy.make_spacy_doc(text, lang="es_core_news_sm")
      >>> ts = textacy.text_stats.TextStats(doc)
      >>> ts.readability("perspicuity-index")
      56.46000000000002
      >>> ts.readability("mu-legibility-index")
      71.18644067796609
  
  Each of these stats have stand-alone functions in :mod:`textacy.text_stats.basics` ,
  :mod:`textacy.text_stats.readability` , and :mod:`textacy.text_stats.diversity`
  with more detailed info and links in the docstrings -- when in doubt, read the docs!
  
  Args:
      doc: A text document tokenized and (optionally) sentence-segmented by spaCy.
  
  Warning:
      The ``TextStats`` class is deprecated as of v0.12. Instead,
      call the stats functions directly --
      ``text_stats.TextStats(doc).n_sents`` => ``text_stats.n_sents(doc)`` --
      or set them as custom doc extensions and access them from the ``Doc`` --
      ``textacy.set_doc_extensions('text_stats'); doc._.n_sents`` .
code: def __init__(self, doc: Doc):
      utils.deprecated(
          "The `TextStats` class is deprecated as of v0.12. "
          "Instead, call the stats functions directly -- "
          "`text_stats.TextStats(doc).n_sents` => `text_stats.n_sents(doc)` --"
          "or set them as custom doc extensions and access them on the ``Doc`` -- "
          "`textacy.set_doc_extensions('text_stats'); doc._.n_sents` .",
          action="once",
      )
      self.doc = doc
      self.lang: str = doc.lang_
      self.words: tuple[Token, ...] = tuple(
          extract.words(
              doc,
              filter_punct=True,
              filter_stops=False,
              filter_nums=False,
          )
      )
      self._n_sents: Optional[int] = None
      self._n_words: Optional[int] = None
      self._n_unique_words: Optional[int] = None
      self._n_long_words: Optional[int] = None
      self._n_chars_per_word: Optional[tuple[int, ...]] = None
      self._n_chars: Optional[int] = None
      self._n_syllables_per_word: Optional[tuple[int, ...]] = None
      self._n_syllables: Optional[int] = None
      self._n_monosyllable_words: Optional[int] = None
      self._n_polysyllable_words: Optional[int] = None
      self._entropy: Optional[float] = None
  
imports: from __future__ import annotations
  import logging
  from typing import Literal, Optional
  from spacy.tokens import Doc, Token
  from ..None import errors, extract, utils
  from .None import basics, counts, diversity, readability
label_desc: Use image node_id 1 to create a new TextStats object  with example: obj = TextStats(doc)