diff --git a/Context_update/main.py b/Context_update/main.py new file mode 100644 index 0000000..de3f4e9 --- /dev/null +++ b/Context_update/main.py @@ -0,0 +1,30 @@ +import json + +input_file_path = '' #path +with open(input_file_path, 'r', encoding='utf-8') as file: + data = json.load(file) + +for item in data: + if isinstance(item, dict): + name = item.get("qanon_title", "") + item.update({ + "context": { + "qanon_name": name, + "parents_content": "parent_content_value", + "meaning_change": [{ + "term": "str1", + "meaning" : "def" + }], + "referential term" : [{ + "term": "this", + "referent" : "that" + }] + } + }) +print("done") + +output_file_path = 'output_data.json' +with open(output_file_path, 'w', encoding='utf-8') as file: + json.dump(data, file, indent=4, ensure_ascii=False) +print(f"Modified data has been saved to {output_file_path}") +