mirror of
https://github.com/Rushilwiz/openly.git
synced 2025-04-06 21:30:17 -04:00
15 lines
464 B
Python
15 lines
464 B
Python
import nlp
|
|
import random
|
|
|
|
# get user preference from database (i.e. how many times they clicked on some certain type of article)
|
|
# prob = [1/nlp.NUM_TOPICS for i in range(nlp.NUM_TOPICS)]
|
|
# manipulate prob based on user preference
|
|
|
|
|
|
def get_topics(weights, num_reccomendations):
|
|
"""
|
|
Takes in weights as list/tuple, ex: (0.1, 0.2, 0.3)
|
|
Returns a list of topics
|
|
"""
|
|
return random.choices([*range(nlp.NUM_TOPICS)], weights, k=num_reccomendations)
|