refactor codes and names
This commit is contained in:
@@ -2,6 +2,7 @@ from app.common.normalizer import Normalizer
|
||||
from app.common.tokenizer import *
|
||||
from app.common.jalali import Gregorian,Persian
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
from re import sub
|
||||
import textwrap
|
||||
@@ -1325,6 +1326,27 @@ def extract_excel_fields(file_path: str, fields: list = [], sheet_name: str = No
|
||||
print(f"❌ خطا در خواندن فایل اکسل: {e}")
|
||||
return []
|
||||
|
||||
|
||||
|
||||
def get_files(directory, pattern_file=r"output_(\d+)\.json$"):
|
||||
|
||||
pattern = None
|
||||
if pattern_file :
|
||||
pattern = re.compile(pattern_file)
|
||||
|
||||
max_num = 0
|
||||
list_file = []
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
if pattern :
|
||||
match = pattern.match(filename)
|
||||
if match:
|
||||
list_file.append(directory+"/"+filename)
|
||||
else:
|
||||
list_file.append(directory+"/"+filename)
|
||||
|
||||
return list_file
|
||||
|
||||
# prefix, title = normalHeadingTitle("فصل اول - سیاستها و اصول")
|
||||
# print('prefix :', prefix)
|
||||
# print('title :', title)
|
||||
Reference in New Issue
Block a user