(doc: Doc, *, variant: int = 1)
Readability test for German-language texts, whose value estimates the grade
    level required to understand a text.

    Higher value => more difficult text.

    Args:
        doc
        variant

    References:
        https://de.wikipedia.org/wiki/Lesbarkeitsindex#Wiener_Sachtextformel
Readability test for German-language texts, whose value estimates the grade
    level required to understand a text.
Readability test for German - language texts whose value estimates the grade level required to understand a text .
def wiener_sachtextformel(doc: Doc, *, variant: int = 1) -> float:
    """
    Readability test for German-language texts, whose value estimates the grade
    level required to understand a text.

    Higher value => more difficult text.

    Args:
        doc
        variant

    References:
        https://de.wikipedia.org/wiki/Lesbarkeitsindex#Wiener_Sachtextformel
    """
    if doc.lang_ != "de":
        LOGGER.warning(
            "doc lang = '%s', but this readability statistic is intended for use on "
            "'de'-language texts only",
            doc.lang_,
        )

    words = tuple(utils.get_words(doc))
    n_sents = basics.n_sents(doc)
    n_words = basics.n_words(words)
    n_long_words = basics.n_long_words(words)
    n_polysyllable_words = basics.n_polysyllable_words(words, lang=doc.lang_)
    n_monosyllable_words = basics.n_monosyllable_words(words, lang=doc.lang_)

    ms = 100 * n_polysyllable_words / n_words
    sl = n_words / n_sents
    iw = 100 * n_long_words / n_words
    es = 100 * n_monosyllable_words / n_words
    if variant == 1:
        return (0.1935 * ms) + (0.1672 * sl) + (0.1297 * iw) - (0.0327 * es) - 0.875
    elif variant == 2:
        return (0.2007 * ms) + (0.1682 * sl) + (0.1373 * iw) - 2.779
    elif variant == 3:
        return (0.2963 * ms) + (0.1905 * sl) - 1.1144
    elif variant == 4:
        return (0.2744 * ms) + (0.2656 * sl) - 1.693
    else:
        raise ValueError(errors.value_invalid_msg("variant", variant, [1, 2, 3, 4]))
def wiener_sachtextformel ( doc : Doc , * , variant : int = 1 ) -> float : if doc . lang_ != "de" : LOGGER . warning ( "doc lang = '%s', but this readability statistic is intended for use on " "'de'-language texts only" , doc . lang_ , ) words = tuple ( utils . get_words ( doc ) ) n_sents = basics . n_sents ( doc ) n_words = basics . n_words ( words ) n_long_words = basics . n_long_words ( words ) n_polysyllable_words = basics . n_polysyllable_words ( words , lang = doc . lang_ ) n_monosyllable_words = basics . n_monosyllable_words ( words , lang = doc . lang_ ) ms = 100 * n_polysyllable_words / n_words sl = n_words / n_sents iw = 100 * n_long_words / n_words es = 100 * n_monosyllable_words / n_words if variant == 1 : return ( 0.1935 * ms ) + ( 0.1672 * sl ) + ( 0.1297 * iw ) - ( 0.0327 * es ) - 0.875 elif variant == 2 : return ( 0.2007 * ms ) + ( 0.1682 * sl ) + ( 0.1373 * iw ) - 2.779 elif variant == 3 : return ( 0.2963 * ms ) + ( 0.1905 * sl ) - 1.1144 elif variant == 4 : return ( 0.2744 * ms ) + ( 0.2656 * sl ) - 1.693 else : raise ValueError ( errors . value_invalid_msg ( "variant" , variant , [ 1 , 2 , 3 , 4 ] ) )