def test_spell_correct():
    s1 = sentence_sentiment('The book was aweosme.').compound
    s2 = sentence_sentiment('The book was kind of awesom.').compound

    assert s1 > 0
    assert s2 > 0
    assert s1 > s2
def test_kind_of():
    s1 = sentence_sentiment('The book was good.').compound
    s2 = sentence_sentiment('The book was kind of good.').compound
    assert s1 > s2
def test_allcaps_emphasis():
    s1 = sentence_sentiment('Eric is smart and handsome.').compound
    s2 = sentence_sentiment('Eric is SMART and HANDSOME.').compound
    assert s1 < s2
def test_punctuation_emphasis():
    s1 = sentence_sentiment('Eric is smart, handsome, and funny.').compound
    s2 = sentence_sentiment('Eric is smart, handsome, and funny!').compound
    assert s1 < s2
Esempio n. 5
0
def assert_neu(text):
    scores = sentence_sentiment(text)
    assert scores.compound == 0
Esempio n. 6
0
def assert_pos(text):
    scores = sentence_sentiment(text)
    assert scores.compound > 0