.
This commit is contained in:
parent
39d014781d
commit
6a46f8cd46
|
|
@ -24,6 +24,33 @@ today = f'{datetime.datetime.now().year}{datetime.datetime.now().month}{datetime
|
||||||
فرق این سورس با ورژن 1 در این هست که برای هرکدام از تایتل ها و مفاهیم کلیدی و ... از پرامپت مخصوص خودش
|
فرق این سورس با ورژن 1 در این هست که برای هرکدام از تایتل ها و مفاهیم کلیدی و ... از پرامپت مخصوص خودش
|
||||||
استفاده میکنه و در چهار فایل جداگانه ذخیره میکنه
|
استفاده میکنه و در چهار فایل جداگانه ذخیره میکنه
|
||||||
'''
|
'''
|
||||||
|
def create_tables():
|
||||||
|
|
||||||
|
cursor.execute("""CREATE TABLE IF NOT EXISTS rules (
|
||||||
|
id TEXT,
|
||||||
|
rule TEXT,
|
||||||
|
type TEXT,
|
||||||
|
part_id TEXT
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
|
||||||
|
cursor.execute("""CREATE TABLE IF NOT EXISTS persons (
|
||||||
|
id TEXT,
|
||||||
|
person TEXT,
|
||||||
|
part_id TEXT
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
|
||||||
|
cursor.execute("""CREATE TABLE IF NOT EXISTS central_concepts (
|
||||||
|
id TEXT,
|
||||||
|
concept TEXT,
|
||||||
|
paragraph_effect REAL,
|
||||||
|
part_id TEXT
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_PROMPT_orginal = """
|
SYSTEM_PROMPT_orginal = """
|
||||||
|
|
@ -467,7 +494,7 @@ def find_passed_data_ids(output_metadata_jsonl_path):
|
||||||
return passed_data_ids
|
return passed_data_ids
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
create_tables() # ساخت تیبل های مورد نیاز اسکیو ال لایت در صورت عدم وجود
|
||||||
input_data_path = './nahj_data/all_nahj_CONTEXT.json' # شامل تمامی (خطبه و نامه و حکمت ها) به همراه پاراگراف هایشان
|
input_data_path = './nahj_data/all_nahj_CONTEXT.json' # شامل تمامی (خطبه و نامه و حکمت ها) به همراه پاراگراف هایشان
|
||||||
llm_error_path = './nahj-answer/error-in-getting-metadata-Final.txt'
|
llm_error_path = './nahj-answer/error-in-getting-metadata-Final.txt'
|
||||||
previous_peroid_errors_path = "./nahj_data/error-ids-Final.txt"
|
previous_peroid_errors_path = "./nahj_data/error-ids-Final.txt"
|
||||||
|
|
@ -516,6 +543,7 @@ if __name__ == "__main__":
|
||||||
print(f"******* PERIOD :: {period} *******")
|
print(f"******* PERIOD :: {period} *******")
|
||||||
for index ,entery in enumerate(data, 1):
|
for index ,entery in enumerate(data, 1):
|
||||||
NN+=1
|
NN+=1
|
||||||
|
err = False
|
||||||
if index > 799:
|
if index > 799:
|
||||||
end = True
|
end = True
|
||||||
break
|
break
|
||||||
|
|
@ -535,7 +563,10 @@ if __name__ == "__main__":
|
||||||
print(f'id: {id} - record: {index}/{len(data)} - period: {period}')
|
print(f'id: {id} - record: {index}/{len(data)} - period: {period}')
|
||||||
|
|
||||||
for path in outs :
|
for path in outs :
|
||||||
if path == "title":
|
|
||||||
|
if err == True :
|
||||||
|
continue
|
||||||
|
elif path == "title":
|
||||||
SYSTEM_PROMPT = SYSTEM_PROMPT_title
|
SYSTEM_PROMPT = SYSTEM_PROMPT_title
|
||||||
elif path == "central":
|
elif path == "central":
|
||||||
SYSTEM_PROMPT = SYSTEM_PROMPT_central
|
SYSTEM_PROMPT = SYSTEM_PROMPT_central
|
||||||
|
|
@ -589,6 +620,7 @@ if __name__ == "__main__":
|
||||||
entery['paragraph_metadata'][num]['rules'] = sec['rules']
|
entery['paragraph_metadata'][num]['rules'] = sec['rules']
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
err = True
|
||||||
print(f'error id: {id} - {e} >> llm result: {result_data}')
|
print(f'error id: {id} - {e} >> llm result: {result_data}')
|
||||||
if id not in error_ids:
|
if id not in error_ids:
|
||||||
error_ids.append(id)
|
error_ids.append(id)
|
||||||
|
|
@ -683,3 +715,4 @@ if __name__ == "__main__":
|
||||||
print(f'full duration: {(datetime.datetime.now() - start).total_seconds()}')
|
print(f'full duration: {(datetime.datetime.now() - start).total_seconds()}')
|
||||||
print(f'all_paragraphs: {all_paragraphs}')
|
print(f'all_paragraphs: {all_paragraphs}')
|
||||||
print('---------------------------------------------')
|
print('---------------------------------------------')
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user