diff --git a/caliGraph.py b/caliGraph.py index df7ba65..b95f08b 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -508,7 +508,7 @@ def genScores(G, books): return globMu, globStd -def recommendNBooks(G, mu, std, n, removeTopListsB=True): +def recommendNBooks(G, mu, std, n, removeTopListsB=True, removeUselessRecommenders=True): removeRestOfSeries(G) removeBad(G, mu-std-1.5) removeKeepBest(G, int(n*2) + 5, maxDistForRead=1.5) @@ -526,7 +526,8 @@ def recommendNBooks(G, mu, std, n, removeTopListsB=True): removeKeepBest(G, n, maxDistForRead=0.75) removeEdge(G) removeDangling(G, alsoBooks=True) - removeUnusedRecommenders(G) + if removeUselessRecommenders: + removeUnusedRecommenders(G) scaleBooksByRating(G) scaleOpinionsByRating(G) @@ -649,6 +650,7 @@ def cliInterface(): parser.add_argument('--no-list', action="store_true") parser.add_argument('--remove-edge', action="store_true") parser.add_argument('--keep-top-lists', action="store_true") + parser.add_argument('--keep-useless-recommenders', action="store_true") cmds = parser.add_subparsers(required=True, dest='cmd') p_rec = cmds.add_parser('recommend', description="TODO", aliases=['rec']) @@ -678,7 +680,7 @@ def cliInterface(): removeUnread(G) if args.cmd=="recommend": - recommendNBooks(G, mu, std, args.n, not args.keep_top_lists) + recommendNBooks(G, mu, std, args.n, not args.keep_top_lists, not args.keep_useless_recommenders) elif args.cmd=="read": readBooksAnalysis(G, args.min_rating, args.all_tags, args.only_connected, not args.keep_top_lists) elif args.cmd=="analyze":