mirror of
https://github.com/Rushilwiz/think-openly.git
synced 2025-04-19 19:00:15 -04:00
18 lines
495 B
Python
18 lines
495 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)
|
|
|
|
|
|
# print(get_topics(prob, 4))
|