2018-01-03 08:39:30 +00:00
|
|
|
#!/usr/local/bin/python
|
|
|
|
# coding: utf-8
|
|
|
|
|
2018-01-06 17:51:16 +00:00
|
|
|
from senpy import easy_test, SentimentBox, MappingMixin
|
2018-01-03 08:39:30 +00:00
|
|
|
|
|
|
|
import basic
|
|
|
|
|
|
|
|
|
2018-01-06 17:51:16 +00:00
|
|
|
class Basic(MappingMixin, SentimentBox):
|
2018-01-03 08:39:30 +00:00
|
|
|
'''Provides sentiment annotation using a lexicon'''
|
|
|
|
|
|
|
|
author = '@balkian'
|
|
|
|
version = '0.1'
|
|
|
|
|
2018-01-06 17:51:16 +00:00
|
|
|
mappings = {
|
|
|
|
'pos': 'marl:Positive',
|
|
|
|
'neg': 'marl:Negative',
|
|
|
|
'default': 'marl:Neutral'
|
|
|
|
}
|
2018-01-03 08:39:30 +00:00
|
|
|
|
2018-04-24 17:36:50 +00:00
|
|
|
def predict_one(self, input):
|
2018-01-06 17:51:16 +00:00
|
|
|
return basic.get_polarity(input)
|
2018-01-03 08:39:30 +00:00
|
|
|
|
|
|
|
test_cases = [{
|
|
|
|
'input': 'Hello :)',
|
|
|
|
'polarity': 'marl:Positive'
|
|
|
|
}, {
|
|
|
|
'input': 'So sad :(',
|
|
|
|
'polarity': 'marl:Negative'
|
|
|
|
}, {
|
|
|
|
'input': 'Yay! Emojis 😁',
|
|
|
|
'polarity': 'marl:Positive'
|
|
|
|
}, {
|
|
|
|
'input': 'But no emoticons 😢',
|
|
|
|
'polarity': 'marl:Negative'
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
easy_test()
|