def get_pkgs_of_recommendation(strategy):
    app_recommender = AppRecommender()

    app_recommender.recommender.set_strategy(strategy)
    rec = app_recommender.make_recommendation(print_recommendation=False)

    pkgs = RE_MATCH.findall(rec.__str__())

    return pkgs
示例#2
0
    def get_recommendation_pkgs(self, installed_pkgs):
        app_recommender = AppRecommender()

        app_recommender.recommender.set_strategy('cbpkg')
        rec = app_recommender.make_recommendation(
            reference_pkgs=installed_pkgs, print_recommendation=False)

        pkgs_regex = re.compile(r'^\d:\s([^\s]+)', re.MULTILINE)
        pkgs = pkgs_regex.findall(rec.__str__())

        return pkgs
示例#3
0
def run_apprecommender(reference_pkgs):
    try:
        app_recommender = AppRecommender()
        app_recommender.make_recommendation(reference_pkgs)
        return SUCCESS
    except xapian.DatabaseOpeningError:
        return ERROR_INIT
    except IOError:
        if "ml" in Config().strategy:
            return ERROR_TRAIN
    except OSError:
        return PERMISSION_DENIED