def sentyment(wordlist):
    sp = SenticPhrase(wordlist)
    if sp.info(wordlist)['sentiment'] == 'strong negative':
        text_sentiment = -2
    elif sp.info(wordlist)['sentiment'] == 'weak negative':
        text_sentiment = -1
    elif sp.info(wordlist)['sentiment'] == 'neutral':
        text_sentiment = 0
    elif sp.info(wordlist)['sentiment'] == 'weak positive':
        text_sentiment = 1
    elif sp.info(wordlist)['sentiment'] == 'strong positive':
        text_sentiment = 2
    return text_sentiment
Beispiel #2
0
def sentyki(wordlist):
    sp = SenticPhrase(wordlist)
    try:
        text_aptitude = sp.info(wordlist)['sentics']['aptitude']
    except KeyError:
        text_aptitude = 0
    try:
        text_pleasantness = sp.info(wordlist)['sentics']['pleasantness']
    except KeyError:
        text_pleasantness = 0
    try:
        text_attention = sp.info(wordlist)['sentics']['attention']
    except KeyError:
        text_attention = 0
    try:
        text_sensitivity = sp.info(wordlist)['sentics']['sensitivity']
    except KeyError:
        text_sensitivity = 0
    return text_aptitude, text_attention, text_pleasantness, text_sensitivity