From 3f5b4156c9957d2fc8974e99d3b6ae45ef1d7278 Mon Sep 17 00:00:00 2001 From: Leomotors <59821765+Leomotors@users.noreply.github.com> Date: Tue, 3 Aug 2021 01:28:22 +0700 Subject: [PATCH] Approve All added --- utils/review.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/utils/review.py b/utils/review.py index 14b7320..fc9182d 100644 --- a/utils/review.py +++ b/utils/review.py @@ -11,24 +11,29 @@ try: quote_file = open("./assets/json/morequotes.json", "r") except: - quotes = {"วาทกรรมสลิ่ม":[]} + quotes = {"วาทกรรมสลิ่ม": []} else: quotes = json.load(quote_file) +mode = int(input("Approve Mode [1 for One by One or 0 for Approve All]")) + with open("./utils/train.txt") as train_data: train_quotes = train_data.readlines() for q in train_quotes: q = q[:-1] print(q) - choice = input("APPROVE? [Y for Yes, otherwise any key] => ") - if (choice[0] == 'Y' or choice[0] == 'y'): + if mode: + choice = input("APPROVE? [Y for Yes, otherwise any key] => ") + if (choice[0] == 'Y' or choice[0] == 'y'): + quotes["วาทกรรมสลิ่ม"].append(q) + else: quotes["วาทกรรมสลิ่ม"].append(q) print() if len(train_quotes) <= 0: print("Nothing to train here! Come back later!") exit() - + with open("./assets/json/morequotes.json", "w") as outfile: final_str = str(quotes) final_str = final_str.replace('"', '\\"')