По просьбам присутствовавших сегодня на семинаре, выкладываю шаблон класса SentimentAnalyzer.py. В последней строчке написано как из этого шаблона получить Baseline_1.
class SentimentAnalyzer:
#constructor (optional)
def __init__(self):
None
#trainer of classifier (mandatory)
def train(self, training_corpus):
# train your classifier here
self.classifier = None
#returns sentiment score of input text (mandatory)
def getClasses(self, texts):
#Write your code instead of next line
return ['neutral' for iter in texts] # Baseline 1
Внимание, чтобы была возможность самостоятельно фильтровать данные, на вход функции train() подается тренировочный корпус в формате json, полученный примерно так:
training_corpus = json.load(open(path_to_training_corpus))