41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
import json
|
|
import datetime
|
|
|
|
from general_functions import read_file_by_address, read_from_json
|
|
|
|
if __name__ == "__main__":
|
|
start_time = datetime.datetime.now()
|
|
print(f'start time: {start_time}')
|
|
|
|
# inputfile = open('./data/main_classes_dataset_03.json', "r", encoding='utf-8')
|
|
# inputfile = open('./data/sections_40k_normalized.json', "r", encoding='utf-8')
|
|
# data = json.load(inputfile)
|
|
# inputfile.close()
|
|
|
|
# prev_ids = read_file_by_address('./data/prev_kw_ids_170k.txt').splitlines()
|
|
|
|
counter = 1
|
|
file_counter = 1
|
|
temp_dict = []
|
|
temp_data_text = ''
|
|
period_sections = []
|
|
period_ids_text = f'***** file number: {file_counter} *****\n'
|
|
|
|
finall_sections = []
|
|
for file_counter in range(1,41):
|
|
|
|
# inputfile = open(f'./data/sections_kw_llama8b_170k_{str(file_counter)}.json', "a+", encoding='utf-8')
|
|
data = read_from_json(f'./data/sections_kw_llama8b_40k_{str(file_counter)}.json')
|
|
|
|
print(f'file {file_counter} is in proccess ... ')
|
|
for item in data:
|
|
id = item['id']
|
|
finall_sections.append(item)
|
|
|
|
outputfile = open(f'./data/sections_kw_llama8b_40k_concatenated.json', "a+", encoding='utf-8')
|
|
outputfile.write(json.dumps(finall_sections, ensure_ascii=False, indent=2))
|
|
outputfile.close()
|
|
|
|
end_time = datetime.datetime.now()
|
|
print(f"end_time: {end_time}")
|
|
print("end") |