removed load save functions
This commit is contained in:
parent
695cef2b32
commit
e5c2794c06
@ -1,20 +1,9 @@
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from squad_utils import print_squad
|
||||
|
||||
|
||||
def load(filename):
|
||||
with open(filename, "r") as f:
|
||||
squad = json.load(f)
|
||||
|
||||
return squad
|
||||
|
||||
|
||||
def save(filename, squad):
|
||||
with open(filename, "w") as f:
|
||||
json.dump(squad, f, indent=2)
|
||||
|
||||
|
||||
def sort_qas_by_answer_index(squad):
|
||||
for article in squad['data']:
|
||||
for paragraph in article['paragraphs']:
|
||||
@ -83,11 +72,13 @@ def add_special_chars_to_paragraph(paragraph):
|
||||
if __name__ == "__main__":
|
||||
load_dotenv()
|
||||
|
||||
squad = load('./squad-test.json')
|
||||
with open("./squad-test.json", "r") as f:
|
||||
squad = json.load(f)
|
||||
|
||||
sort_qas_by_answer_index(squad)
|
||||
transform_squad(squad)
|
||||
print_squad(squad)
|
||||
|
||||
save("./squad-test-translated.json", squad)
|
||||
with open("./squad-test-translated.json", "w") as f:
|
||||
json.dump(squad, f, indent=2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user