From d585b5932cbcecb64aea3e5dca7309fdeff6b861 Mon Sep 17 00:00:00 2001 From: sara-02 Date: Mon, 18 Dec 2017 13:12:16 +0530 Subject: [PATCH] Add key-value for component companion count --- f8a_worker/graphutils.py | 6 ++++++ f8a_worker/workers/recommender.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/f8a_worker/graphutils.py b/f8a_worker/graphutils.py index f2f168af2..c0b11355d 100644 --- a/f8a_worker/graphutils.py +++ b/f8a_worker/graphutils.py @@ -223,6 +223,12 @@ def create_package_dict(graph_results, alt_dict=None): } if epv['pkg'].get('cooccurrence_probability'): pkg_dict['cooccurrence_probability'] = epv['pkg']['cooccurrence_probability'] + + # Add the co-occurence count as well. + if epv['pkg'].get('cooccurrence_count'): + pkg_dict['cooccurrence_count'] = epv[ + 'pkg']['cooccurrence_count'] + github_dict = { 'dependent_projects': epv['pkg'].get('libio_dependents_projects', [-1])[0], 'dependent_repos': epv['pkg'].get('libio_dependents_repos', [-1])[0], diff --git a/f8a_worker/workers/recommender.py b/f8a_worker/workers/recommender.py index f1936d597..fd7135c30 100644 --- a/f8a_worker/workers/recommender.py +++ b/f8a_worker/workers/recommender.py @@ -427,6 +427,8 @@ def get_topics_for_comp(self, comp_list, pgm_list): epv['pkg']['pgm_topics'] = pgm_epv.get('topic_list', []) epv['pkg']['cooccurrence_probability'] = pgm_epv.get( 'cooccurrence_probability', 0) + epv['pkg']['cooccurrence_count'] = pgm_epv.get( + 'cooccurrence_count', 0) return comp_list