The goal of this file is to work on the dataset of more than 600 sections on the domain of insurance law.
31 lines
913 B
Python
31 lines
913 B
Python
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}")
|
|
|