(doc: Doc)
return (
        100
        * (n_words / (n_words - 1))
        * (statistics.mean(n_chars_per_word) / statistics.variance(n_chars_per_word))
    )
Readability test for Spanish-language texts based on number of words and
    the mean and variance of their lengths in characters, whose value is in the range
    [0, 100].

    Higher value => easier text.

    Args:
        doc

    References:
        Muñoz, M., and J. Muñoz. "Legibilidad Mµ." Viña del Mar: CHL (2006).
Readability test for Spanish-language texts based on number of words and
    the mean and variance of their lengths in characters, whose value is in the range
    [0, 100].
Readability test for Spanish - language texts based on number of words and the mean and variance of their lengths in characters whose value is in the range [ 0 100 ] .
def mu_legibility_index(doc: Doc) -> float:
    """
    Readability test for Spanish-language texts based on number of words and
    the mean and variance of their lengths in characters, whose value is in the range
    [0, 100].

    Higher value => easier text.

    Args:
        doc

    References:
        Muñoz, M., and J. Muñoz. "Legibilidad Mµ." Viña del Mar: CHL (2006).
    """
    if doc.lang_ != "es":
        LOGGER.warning(
            "doc lang = '%s', but this readability statistic is intended for use on "
            "'es'-language texts only",
            doc.lang_,
        )
    n_chars_per_word = basics.n_chars_per_word(doc)
    n_words = len(n_chars_per_word)
    if n_words < 2:
        LOGGER.warning(
            "mu legibility index is undefined for texts with fewer than two words; "
            "returning 0.0"
        )
        return 0.0
    return (
        100
        * (n_words / (n_words - 1))
        * (statistics.mean(n_chars_per_word) / statistics.variance(n_chars_per_word))
    )
def mu_legibility_index ( doc : Doc ) -> float : if doc . lang_ != "es" : LOGGER . warning ( "doc lang = '%s', but this readability statistic is intended for use on " "'es'-language texts only" , doc . lang_ , ) n_chars_per_word = basics . n_chars_per_word ( doc ) n_words = len ( n_chars_per_word ) if n_words < 2 : LOGGER . warning ( "mu legibility index is undefined for texts with fewer than two words; " "returning 0.0" ) return 0.0 return ( 100 * ( n_words / ( n_words - 1 ) ) * ( statistics . mean ( n_chars_per_word ) / statistics . variance ( n_chars_per_word ) ) )