31 lines
954 B
Python
31 lines
954 B
Python
|
"""
|
||
|
در این فایل ، به سکشن های فایل 7 هزارتایی، کد موضوعی مربوط به 53 دسته اضافه می شود
|
||
|
"""
|
||
|
from funcs import read_from_json, write_to_json
|
||
|
import datetime
|
||
|
|
||
|
print(datetime.datetime.now())
|
||
|
|
||
|
main_7k_sections = read_from_json("./data/sections_7k_metadata.json")
|
||
|
sections_7k_codeai = read_from_json("./data/sections_7k_codeai.json")
|
||
|
|
||
|
count = 0
|
||
|
updated_sections = []
|
||
|
|
||
|
for section in main_7k_sections:
|
||
|
count += 1
|
||
|
id = section["id"]
|
||
|
# if count > 500:
|
||
|
# break
|
||
|
coded_section = next((section for section in sections_7k_codeai if section["id"] == id), None)
|
||
|
if not coded_section:
|
||
|
print(f"not found {id}")
|
||
|
section["ai-code"] = coded_section["code-ai"]
|
||
|
|
||
|
updated_sections.append(section)
|
||
|
|
||
|
write_to_json(updated_sections, "./data/sections_7K_full_metadata2.json")
|
||
|
|
||
|
print(datetime.datetime.now())
|
||
|
print(" # # # relation update finished! # # # ")
|