Beispiel #1
0
def test_basics_sent_tok_correct():

    assert sent_tokenise("this is the end. my only friend. the end") == [
        "this is the end.",
        "my only friend.",
        "the end",
    ]
Beispiel #2
0
def test_basics_sent_tok_and_Vader():

    assert (np.mean(
        get_sentiment_score_VDR(
            sent_tokenise(
                "I know that sounds funny, but to me it seemed like sketchy technology that wouldn't work well. Well, this one works great."
            ))) == 0.595050)
Beispiel #3
0
def test_remove_stopwords():

    wish = "And did they get you to trade Your heros for ghosts? Hot ashes for trees? Hot air for a cool breeze?"
    wishtokens_sw_removed = remove_stopwords(word_tokenise(
        sent_tokenise(wish)))
    assert wishtokens_sw_removed == [
        ["And", "get", "trade", "Your", "heros", "ghosts", "?"],
        ["Hot", "ashes", "trees", "?"],
        ["Hot", "air", "cool", "breeze", "?"],
    ]
Beispiel #4
0
def test_basics_sent_tok_exception():
    with pytest.raises(TypeError):
        sent_tokenise(True, 2)
Beispiel #5
0
def test_basics_sent_tok_hasoutput():

    assert sent_tokenise(
        "this is the end. my only friend. the end") is not None
def test_combine_2fs():
    assert sent_tokenise(capital_case(mystring)) == f_pipeline2(mystring)
def test_combine_functions():
    assert sent_tokenise(capital_case(mystring)) == f_pipeline(mystring)