Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_game(names):
- #name = "The Lord of the Rings: The Battle for Middle-Earth"
- games=[]
- for name in names:
- datas= game_id_df[game_id_df.Title == name]
- if not datas.empty:
- data_index = game_id_df[game_id_df.Title == name].index[0]
- train_data_reviews[data_index]
- new_datapoint = [train_data_reviews[data_index]]
- new_vec = lsa.transform(tfidf_vectorizer.transform(new_datapoint))
- nn = NearestNeighbors(n_neighbors=5, metric='cosine', algorithm='brute')
- nn.fit(lsa_tfidf_data)
- result = nn.kneighbors(new_vec)
- for r in result[1][0]:
- game = game_id_df.Title[r]
- if game not in games:
- games.append(game)
- return(games)
- profile = sys.argv[1]
- response = req.get("https://localhost:5001/api/profile/getUserGamesNames?userId=" + profile)
- data = json.loads(response.text)
- games_list = []
- for games in data['games']:
- games_list.append(games)
- list_of_games= get_game(games_list)
- with open('list_of_games.txt', 'w') as f:
- for item in list_of_games:
- f.write("%s\n" % item)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement