def __init__(self, debug=False, log=None, data_dir="data", clf_type=None): if clf_type is None: self.__print__('ERR', 'unable to create SentiAnalys obj: no classificator type') sys.exit(1) TextParser.__init__(self, debug, log, data_dir) self.senti_class = ['нейтральная', 'позитивная', 'негативная'] if clf_type == 0: clf_fname = 'log_clf.model' elif clf_type == 1: clf_fname = 'xgboost_clf.model' else: self.__print__('ERR', 'unable to create SentiAnalys obj: incorrect classificator type {}'.format(clf_type)) sys.exit(1) self.clf_type = clf_type try: clf_f = open(clf_fname, 'r') self.clf = pickle.load(clf_f) # TODO: check clf type clf_f.close() except Exception as e: self.__print__('ERR', "unable to init SentiAnalys obj: {}".format(e))
def __init__(self, batch_size=50, debug=False, log=None, data_dir="data"): TextParser.__init__(self, debug, log, data_dir) self.db_cn = DBConnector() self.__select_news_agent_info__() self.batch_size = batch_size
def __init__(self, debug=False, log=None, data_dir="data"): TextParser.__init__(self, debug, log, data_dir)