shadowtube/examples/inner_test.py
2025-02-18 17:46:37 +01:00

38 lines
1.2 KiB
Python

#
# Copyright (c) 2025 Fedir Kovalov.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import shadowtube.preprocess as prep
import shadowtube.recommend as rec
raw_history = prep.parse_database("./short.db")
# print(raw_history[0]["title"] + ": " + str(prep.relevancy(raw_history[0], raw_history)))
# print(
# raw_history[28]["title"] + ": " + str(prep.relevancy(raw_history[28], raw_history))
# )
# for i in range(0, 10):
# print(prep.get_similarity(raw_history[i], raw_history))
history = prep.sort_history(raw_history)
print(len(history))
# print(recommend(history))
recommendations = rec.recommend(history, verbose=False)
print(recommendations)