Ejemplo n.º 1
0
def test_n_syllables_per_word(doc, words):
    n_doc = basics.n_syllables_per_word(doc, "en")
    n_words = basics.n_syllables_per_word(words, "en")
    n_expected = (
        1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 3, 1, 1, 1, 3, 1, 2, 3, 1, 1, 2, 1, 1, 1, 3, 1
    )
    assert n_doc == n_words == n_expected
Ejemplo n.º 2
0
def test_n_polysyllable_words(words, min_n_syllables, n_exp):
    n_syllables_per_word = basics.n_syllables_per_word(words, "en")
    n_polysyllable_words = basics.n_polysyllable_words(
        n_syllables_per_word,
        min_n_syllables=min_n_syllables,
    )
    assert n_polysyllable_words == n_exp
Ejemplo n.º 3
0
def test_n_syllables(words):
    n_syllables_per_word = basics.n_syllables_per_word(words, "en")
    n_syllables = basics.n_syllables(n_syllables_per_word)
    assert n_syllables == 38
Ejemplo n.º 4
0
def test_n_monosyllable_words(words):
    n_syllables_per_word = basics.n_syllables_per_word(words, "en")
    n_monosyllable_words = basics.n_monosyllable_words(n_syllables_per_word)
    assert n_monosyllable_words == pytest.approx(18, rel=0.05)