diff --git a/app/code/utils.py b/app/code/utils.py index b5bc586a..1e53953e 100755 --- a/app/code/utils.py +++ b/app/code/utils.py @@ -15,29 +15,22 @@ FIELDS += 'publicationTypes,publicationDate,citationCount,' FIELDS += 'publicationVenue,externalIds,abstract' -def add_negative_articles(topic_obj, dic, max_num_articles=10): +def add_negative_articles(topic_obj, dic): """ Add the negative articles to the topic object """ if 'negative' not in topic_obj.paper_ids: topic_obj.paper_ids['negative'] = {} - num_topics = len(dic) - 1 - while len(topic_obj.paper_ids["negative"]) < max_num_articles: - for topic in dic: - if topic == topic_obj.topic: + for topic in dic: + # Skip the current topic + if topic == topic_obj.topic: + continue + # Add the articles from the other topics + # as negative articles to the current topic + for paper_id in dic[topic].paper_ids['positive']: + if paper_id in topic_obj.paper_ids['negative']: continue - articles_per_topic = max_num_articles // num_topics - for paper_id in dic[topic].paper_ids['positive']: - if paper_id in topic_obj.paper_ids['negative']: - continue - topic_obj.paper_ids['negative'][paper_id]=dic[topic].paper_ids['positive'][paper_id] - articles_per_topic -= 1 - if articles_per_topic == 0: - break - if len(topic_obj.paper_ids["negative"]) == max_num_articles: - break - if len(topic_obj.paper_ids["negative"]) == max_num_articles: - break + 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}.') def update_paper_details(topic_obj): diff --git a/docs/recommendations/06a0ba437d41a7c82c08a9636a4438c1b5031378.md b/docs/recommendations/06a0ba437d41a7c82c08a9636a4438c1b5031378.md index 37319a7d..2373fca1 100644 --- a/docs/recommendations/06a0ba437d41a7c82c08a9636a4438c1b5031378.md +++ b/docs/recommendations/06a0ba437d41a7c82c08a9636a4438c1b5031378.md @@ -11,7 +11,7 @@ hide:
- This page was last updated on 2024-08-05 09:00:07 UTC + This page was last updated on 2024-08-08 13:17:20 UTC
- This page was last updated on 2024-08-05 09:00:11 UTC + This page was last updated on 2024-08-08 13:17:27 UTC
- This page was last updated on 2024-08-05 08:59:44 UTC + This page was last updated on 2024-08-08 13:16:41 UTC
- This page was last updated on 2024-08-05 08:59:46 UTC + This page was last updated on 2024-08-08 13:16:44 UTC
- This page was last updated on 2024-08-05 08:59:49 UTC + This page was last updated on 2024-08-08 13:16:50 UTC
- This page was last updated on 2024-08-05 08:59:47 UTC + This page was last updated on 2024-08-08 13:16:45 UTC
- This page was last updated on 2024-08-05 08:59:53 UTC + This page was last updated on 2024-08-08 13:16:58 UTC
- This page was last updated on 2024-08-05 09:00:08 UTC + This page was last updated on 2024-08-08 13:17:23 UTC
- This page was last updated on 2024-08-05 09:00:10 UTC + This page was last updated on 2024-08-08 13:17:26 UTC
- This page was last updated on 2024-08-05 09:00:04 UTC + This page was last updated on 2024-08-08 13:17:15 UTC
- This page was last updated on 2024-08-05 09:00:05 UTC + This page was last updated on 2024-08-08 13:17:17 UTC
- This page was last updated on 2024-08-05 08:59:42 UTC + This page was last updated on 2024-08-08 13:16:38 UTC
- This page was last updated on 2024-08-05 09:00:07 UTC + This page was last updated on 2024-08-08 13:17:21 UTC
- This page was last updated on 2024-08-05 08:59:48 UTC + This page was last updated on 2024-08-08 13:16:48 UTC
- This page was last updated on 2024-08-05 08:59:52 UTC + This page was last updated on 2024-08-08 13:16:55 UTC
- This page was last updated on 2024-08-05 09:00:02 UTC + This page was last updated on 2024-08-08 13:17:12 UTC
- This page was last updated on 2024-08-05 09:00:03 UTC + This page was last updated on 2024-08-08 13:17:14 UTC
- This page was last updated on 2024-08-05 08:59:51 UTC + This page was last updated on 2024-08-08 13:16:54 UTC
- This page was last updated on 2024-08-05 09:00:09 UTC + This page was last updated on 2024-08-08 13:17:24 UTC
- This page was last updated on 2024-08-05 09:00:11 UTC + This page was last updated on 2024-08-08 13:17:29 UTC
- This page was last updated on 2024-08-05 09:00:06 UTC + This page was last updated on 2024-08-08 13:17:18 UTC
- This page was last updated on 2024-08-05 09:00:13 UTC + This page was last updated on 2024-08-08 13:17:32 UTC
- This page was last updated on 2024-08-05 08:59:53 UTC + This page was last updated on 2024-08-08 13:16:57 UTC
- This page was last updated on 2024-08-05 08:59:45 UTC + This page was last updated on 2024-08-08 13:16:42 UTC
- This page was last updated on 2024-08-05 08:59:41 UTC + This page was last updated on 2024-08-08 13:16:36 UTC
- This page was last updated on 2024-08-05 08:59:43 UTC + This page was last updated on 2024-08-08 13:16:39 UTC
- This page was last updated on 2024-08-05 08:59:50 UTC + This page was last updated on 2024-08-08 13:16:52 UTC
- This page was last updated on 2024-08-05 09:00:12 UTC + This page was last updated on 2024-08-08 13:17:30 UTC
- This page was last updated on 2024-08-05 08:59:48 UTC + This page was last updated on 2024-08-08 13:16:47 UTC
- This page was last updated on 2024-08-05 08:59:54 UTC + This page was last updated on 2024-08-08 13:17:00 UTC