initial commit of project

This commit is contained in:
2021-04-11 19:51:12 +02:00
commit a21a8186d9
110 changed files with 16326178 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import json
def main():
eval_path = "final_Versions/models/vers2/eval/"
file_name = "substitute_pairs_65.json"
found_substitutes_path = eval_path + file_name
with open(found_substitutes_path, "r") as whole_json_file:
model_substitutes_dict = json.load(whole_json_file)
data_path = "data/"
occurances_path = "mult_ingredients_nice.json"
with open(data_path + occurances_path, "r") as whole_json_file:
occurrences_dict = json.load(whole_json_file)
all_substitutes = {}
for ingredient in occurrences_dict.keys():
if ingredient not in model_substitutes_dict.keys():
all_substitutes[ingredient] = []
# print(ingredient)
else:
all_substitutes[ingredient] = model_substitutes_dict[ingredient]
print(str(len(all_substitutes.keys())))
out_path = eval_path + "complete_" + file_name
with open(out_path, 'w') as f:
json.dump(all_substitutes, f, ensure_ascii=False, indent=4)
main()