Skip to content

Commit

Permalink
feat: do not consider an article negative if it is already positive f…
Browse files Browse the repository at this point in the history
…or a topic
  • Loading branch information
gurdeep330 committed Aug 8, 2024
1 parent 7252026 commit eef588c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ def add_negative_articles(topic_obj, dic):
# Add the articles from the other topics
# as negative articles to the current topic
for paper_id in dic[topic].paper_ids['positive']:
# Skip if the article is already in the negative articles
if paper_id in topic_obj.paper_ids['negative']:
continue
# Skip if the article is already in the positive articles
if paper_id in topic_obj.paper_ids['positive']:
continue
topic_obj.paper_ids['negative'][paper_id]=dic[topic].paper_ids['positive'][paper_id]
print (f'Added {len(topic_obj.paper_ids["negative"])} negative articles for {topic_obj.topic}.')

Expand Down

0 comments on commit eef588c

Please sign in to comment.