diff --git a/recommendation_engine.py b/recommendation_engine.py index 9679ec7..b08f010 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -96,13 +96,13 @@ class Engine: playlists = playlists[channels['userKeywords']:] # For each playlist, compute global keyword score score = {} - for playlist in self.playlists: + for playlist in playlists: score[playlist['name']] = random.random() for tag in [tag for tag in playlist['tags'] if tag in sliders]: score[playlist['name']] += sliders[tag] # Select highest scoring playlists playlists = sorted( - self.playlists, + playlists, key=lambda playlist: -score[playlist['name']] ) videos += playlists[:channels['globalKeywords']]