SmartMultiServerCore added

This commit is contained in:
init_mahdi
2026-03-04 21:17:45 +00:00
parent 7b3611e9cc
commit 826ee8fd35
7 changed files with 1787 additions and 187 deletions
+9 -4
View File
@@ -35,6 +35,7 @@ def merge_json_dir(input_path, output_path):
for json_file in json_files:
try:
data = load_orjson(json_file)
# print(f'data {type(data)}')
if not data: # خالی یا None
failed_files.append(json_file.name)
continue
@@ -44,6 +45,9 @@ def merge_json_dir(input_path, output_path):
if isinstance(data, list) and isinstance(data[0], dict):
for item in data:
item_id = item.get("id")
if not item_id:
item_id = item.get("_id")
if item_id is None:
# اگر id نداشت، می‌تونی تصمیم بگیری: نگه داری یا ردش کنی
# اینجا فرض می‌کنیم فقط مواردی با id معتبر مهم هستند
@@ -188,10 +192,10 @@ def count_tokens(model_name, system_prompt, user_prompt):
# --- نحوه استفاده ---
if __name__ == "__main__":
# ##### یکی کردن تمام بچ های خروجی در یک فایل
# merge_json_dir(
# input_path= '/home1/ava3/project/aiDataParser/task/keyword_extractor/output/batch_data',
# output_path='/home1/ava3/project/aiDataParser/task/keyword_extractor/output/merged_1.json'
# )
merge_json_dir(
input_path= '/home1/ava3/init_mahdi/project/rule_extractor/im_based/data/sequential/subject_unity/output_6152/batch_data',
output_path='/home1/ava3/init_mahdi/project/rule_extractor/im_based/data/sequential/subject_unity/output_6152/final_data_subject_unity.json'
)
###### ساخت یک proccessed id از فایل نهایی
# make_new_proccessed_ids_from_file(
@@ -507,3 +511,4 @@ if __name__ == "__main__":
##########################################################################
print(":D")
# python3 -m aiDataParser.core.data_normalizer