|
import pandas as pd |
|
from tqdm import tqdm |
|
import joblib |
|
|
|
if __name__ == '__main__': |
|
df_scores = pd.read_csv('../../AVA_src/AVA.txt',sep = " ",header = None) |
|
df_scores.columns = df_scores.columns + 1 |
|
df_scores = df_scores.drop(columns=df_scores.columns[0], axis=1) |
|
df_tags = pd.read_csv('../../AVA_src/tags.txt',sep = "|",header = None) |
|
|
|
dict_tags = {0:'None'} |
|
for row in df_tags.iterrows(): |
|
row = row[1] |
|
dict_tags[row[0]] = row[1] |
|
|
|
dict_ = {} |
|
for idx in tqdm(range(len(df_scores))): |
|
row = df_scores.iloc[idx,:] |
|
_id = row[2] |
|
ratings = row.values[1:11] |
|
textual_tag0 = dict_tags[row[13]] |
|
textual_tag1 = dict_tags[row[14]] |
|
dict_[_id] = (ratings,textual_tag0,textual_tag1) |
|
joblib.dump(dict_,"../data/metadata.pkl") |
|
|