backend/passfinder/recomendations/service/mapping/mapping.py

34 lines
983 B
Python
Raw Normal View History

2023-05-21 13:37:21 +03:00
import pickle
attraction_mapping = None
cinema_mapping = None
plays_mapping = None
excursion_mapping = None
concert_mapping = None
2023-05-22 22:37:54 +03:00
def build_dict(list_mapping):
mapping = {}
for idx, elem in enumerate(list_mapping):
mapping.update({elem: idx})
return mapping
2023-05-21 13:37:21 +03:00
with open('passfinder/recomendations/service/mapping/attractions.pickle', 'rb') as file:
2023-05-22 22:37:54 +03:00
attraction_mapping = build_dict(pickle.load(file))
2023-05-21 13:37:21 +03:00
with open('passfinder/recomendations/service/mapping/kino.pickle', 'rb') as file:
2023-05-22 22:37:54 +03:00
cinema_mapping = build_dict(pickle.load(file))
2023-05-21 13:37:21 +03:00
with open('passfinder/recomendations/service/mapping/spektakli.pickle', 'rb') as file:
2023-05-22 22:37:54 +03:00
plays_mapping = build_dict(pickle.load(file))
2023-05-21 13:37:21 +03:00
with open('passfinder/recomendations/service/mapping/excursii.pickle', 'rb') as file:
2023-05-22 22:37:54 +03:00
excursion_mapping = build_dict(pickle.load(file))
2023-05-21 13:37:21 +03:00
with open('passfinder/recomendations/service/mapping/concerts.pickle', 'rb') as file:
2023-05-22 22:37:54 +03:00
concert_mapping = build_dict(pickle.load(file))