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`` .
docstr: Compute a measure of text readability using a method with specified ``name``.
  
  Higher values => more difficult text for the following methods:
  
  - automated readability index
  - automatic arabic readability index
  - colman-liau index
  - flesch-kincaid grade level
  - gunning-fog index
  - lix
  - smog index
  - wiener-sachtextformel
  
  Higher values => less difficult text for the following methods:
  
  - flesch reading ease
  - gulpease index
  - mu legibility index
  - perspicuity index
  
  See Also:
      :mod:`textacy.text_stats.readability`
docstr_tok: ["Compute","a","measure","of","text","readability","using","a","method","with","specified","``","name","``",".","Higher","values","=",">","more","difficult","text","for","the","following","methods",":","-","automated","readability","index","-","automatic","arabic","readability","index","-","colman-liau","index","-","flesch-kincaid","grade","level","-","gunning-fog","index","-","lix","-","smog","index","-","wiener-sachtextformel","Higher","values","=",">","less","difficult","text","for","the","following","methods",":","-","flesch","reading","ease","-","gulpease","index","-","mu","legibility","index","-","perspicuity","index","See","Also",":",":","mod",":","`","textacy.text_stats.readability","`"]
code: def readability(self, name: ReadabilityNameType, **kwargs) -> float:
      """
      Compute a measure of text readability using a method with specified ``name``.
  
      Higher values => more difficult text for the following methods:
  
      - automated readability index
      - automatic arabic readability index
      - colman-liau index
      - flesch-kincaid grade level
      - gunning-fog index
      - lix
      - smog index
      - wiener-sachtextformel
  
      Higher values => less difficult text for the following methods:
  
      - flesch reading ease
      - gulpease index
      - mu legibility index
      - perspicuity index
  
      See Also:
          :mod:`textacy.text_stats.readability`
      """
      # in case users prefer "flesch-reading-ease" or "flesch reading ease"
      # to the underscored func-standard name "flesch_reading_ease"
      name = name.replace("-", "_").replace(" ", "_")
      try:
          func = getattr(readability, name)
      except AttributeError:
          raise ValueError(
              errors.value_invalid_msg(
                  "name",
                  name,
                  list(
                      utils.get_function_names(
                          readability, ignore_private=True
                      )
                  ),
              )
          )
      return func(self.doc, **kwargs)
  
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 14 for calling the TextStats obj's underlying member method code with example usage: obj.readability(name) and returns: func