def _create_author_feature_with_name(self, author_guid, value, feature_name): author_feature = AuthorFeatures() author_feature.author_guid = author_guid author_feature.window_start = date('2010-01-01 00:00:00') author_feature.window_end = date('2020-01-01 23:59:59') author_feature.attribute_name = feature_name author_feature.attribute_value=value self._authors_to_author_features_dict[author_guid].append(author_feature) self._db.update_author_features((author_feature)) self._db.session.commit()
def _convert_row_to_claim(self, row): claim = Claim() claim_id = unicode(row['claim_id']) title = unicode(row['title'], errors='replace') claim.title = title description = unicode(row['description'], errors='replace') claim.description = description url = unicode(row['url']) claim.url = url verdict_date = row['publication_date'] claim.verdict_date = date(verdict_date) post_guid = compute_post_guid(self._social_network_url, claim_id, verdict_date) claim.claim_id = post_guid claim.domain = self._domain keywords = unicode(row['keywords']) claim.keywords = keywords verdict = unicode(row['post_type']) claim.verdict = verdict return claim
def _convert_row_to_post(self, row): post = Post() claim_id = unicode(row['claim_id']) title = unicode(row['title'], errors='replace') post.content = title description = unicode(row['description'], errors='replace') post.description = description url = unicode(row['url']) post.url = url publication_date = row['publication_date'] post.date = date(publication_date) post_guid = compute_post_guid(self._social_network_url, claim_id, publication_date) post.guid = post_guid post.post_id = post_guid post.domain = self._domain post.author = self._author_name author_guid = compute_author_guid_by_author_name(self._author_name) post.author_guid = author_guid post.post_osn_guid = post_guid keywords = unicode(row['keywords']) post.tags = keywords post_type = unicode(row['post_type']) post.post_type = post_type return post
def _convert_row_to_claim(self, row): claim = Claim() # claim_id = unicode(row['claim_id']) title = unicode(row['title'], errors='replace') claim.title = title description = unicode(row['description'], errors='replace') claim.description = description url = unicode(row['url']) claim.url = url verdict_date = row['verdict_date'] claim.verdict_date = date(verdict_date) post_guid = compute_post_guid(self._social_network_url, url, verdict_date) claim.claim_id = post_guid claim.domain = self._domain keywords = unicode(row['keywords']) claim.keywords = keywords verdict = unicode(row['verdict']) claim.verdict = verdict claim.category = unicode(row['main_category']) claim.sub_category = unicode(row['secondary_category']) return claim
def _add_post(self, title, content, author_guid): post = Post() post.author = author_guid post.author_guid = author_guid post.content = content post.title = title post.domain = u'test' post.post_id = len(self._posts) post.guid = post.post_id post.date = date('2020-01-01 23:59:59') self._db.addPost(post) self._db.session.commit() self._posts.append(post)
def _create_post(self, original_liar_dataset_id, speaker, targeted_label, statement): post = Post() post.post_id = str(original_liar_dataset_id) post_guid = compute_post_guid(self._social_network_url, original_liar_dataset_id, '2007-01-01 00:00:00') post.guid = post_guid post.domain = self._domain post.author = speaker author_guid = compute_author_guid_by_author_name(speaker) post.author_guid = author_guid post.post_osn_guid = post_guid post.date = date('2007-01-01 00:00:00') post.post_type = targeted_label post.content = statement return post
def _convert_row_to_claim(self, row): claim = Claim() claim_id = unicode(row['campaign_id']) title = unicode(row['title'], errors='replace') claim.title = title try: verdict_date = datetime.datetime.strftime( datetime.datetime.strptime(row['date'], '%d-%m-%y'), '%Y-%m-%d %H:%M:%S') except: verdict_date = getConfig().eval(self.__class__.__name__, 'default_date') claim.verdict_date = date(verdict_date) post_guid = compute_post_guid(self._social_network_url, claim_id, verdict_date) claim.claim_id = post_guid claim.domain = self._domain keywords = unicode(row['category']) claim.keywords = keywords verdict = unicode(row['campaign_class']) claim.verdict = verdict #claim.claim_topic = unicode(row['category']) return claim