Esempio n. 1
0
def spacy_lang():
    spacy_lang = cache.load_spacy("en")
    text_stats_component = components.TextStatsComponent()
    spacy_lang.add_pipe(text_stats_component, after="parser")

    yield spacy_lang

    # remove component after running these tests
    spacy_lang.remove_pipe("textacy_text_stats")
Esempio n. 2
0
def test_component_attrs():
    attrs_args = [
        None,
        "flesch_kincaid_grade_level",
        ["flesch_kincaid_grade_level", "flesch_reading_ease"],
    ]
    for attrs in attrs_args:
        text_stats_component = components.TextStatsComponent(attrs=attrs)
        assert isinstance(text_stats_component.attrs, tuple) is True
Esempio n. 3
0
def spacy_lang():
    spacy_lang = cache.load_spacy('en')
    text_stats_component = components.TextStatsComponent()
    spacy_lang.add_pipe(text_stats_component, after='parser')

    yield spacy_lang

    # remove component after running these tests
    spacy_lang.remove_pipe('textacy_text_stats')