From 153aa434d5750ba16c9e1115ad55615a8e32c972 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Wed, 13 Oct 2021 15:10:12 +0200 Subject: [PATCH] Implemented listScores command --- caliGraph.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/caliGraph.py b/caliGraph.py index 03902c8..1c9cedd 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -673,6 +673,15 @@ def recommendNBooks(G, mu, std, n, removeTopListsB=True, removeUselessRecommende addScoreToLabels(G) +def listScores(G, mu, std, n): + removeRestOfSeries(G) + removeKeepBest(G, n, maxDistForRead=10) + + scaleBooksByRating(G) + scaleOpinionsByRating(G) + addScoreToLabels(G) + + def fullGraph(G, removeTopListsB=True): removeEdge(G) removeHighSpanTags(G, 7) @@ -897,10 +906,13 @@ def cliInterface(): cmds = parser.add_subparsers(required=True, dest='cmd') p_rec = cmds.add_parser('recommend', description="TODO", aliases=['rec']) - p_rec.add_argument('-n', type=int, default=25, help='number of books to recommend') + p_rec.add_argument('-n', type=int, default=20, help='number of books to recommend') p_rec.add_argument('--tag-based', action="store_true") p_rec.add_argument('--recommender-based', action="store_true") + p_rec = cmds.add_parser('listScores', description="TODO", aliases=['ls']) + p_rec.add_argument('-n', type=int, default=50, help='number of books to recommend') + p_read = cmds.add_parser('read', description="TODO", aliases=[]) p_read.add_argument('--min-rating', type=int, default=0) p_read.add_argument('--all-tags', action="store_true") @@ -935,6 +947,8 @@ def cliInterface(): recommendNBooksRecommenderBased(G, mu, std, args.n, not args.keep_top_lists, not args.keep_useless_recommenders) else: recommendNBooks(G, mu, std, args.n, not args.keep_top_lists, not args.keep_useless_recommenders) + elif args.cmd=="listScores": + listScores(G, mu, std, args.n) elif args.cmd=="read": readBooksAnalysis(G, args.min_rating, args.all_tags, args.only_connected, not args.keep_top_lists) elif args.cmd=="analyze": @@ -958,7 +972,7 @@ def cliInterface(): if not args.no_list: printBestList(G) - if not args.no_web: + if not args.no_web and not args.cmd in ['listScores']: genAndShowHTML(G, darkMode=args.dark_mode)