Spaces:
Sleeping
Sleeping
Edvin Behdadijd
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,23 @@ def compare_skills(skill_1, skill_2):
|
|
| 62 |
|
| 63 |
return score, common_skill
|
| 64 |
|
| 65 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
ner_results = nlp(text)
|
| 67 |
full_name = ''
|
| 68 |
loc = ''
|
|
@@ -101,12 +117,22 @@ def extract_ner_info(text, nlp):
|
|
| 101 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
| 102 |
if age_match:
|
| 103 |
age = int(age_match.group(1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
# بررسی امتیاز شباهت مکان
|
| 105 |
-
|
| 106 |
-
|
| 107 |
return full_name, loc, age
|
| 108 |
|
| 109 |
|
|
|
|
| 110 |
def process_text(input_text):
|
| 111 |
# مسیر فایل اکسلها را وارد کنید
|
| 112 |
job_excel_file_path = 'jobs_output.xlsx'
|
|
|
|
| 62 |
|
| 63 |
return score, common_skill
|
| 64 |
|
| 65 |
+
def calculate_age(date_string):
|
| 66 |
+
current_year = 1403
|
| 67 |
+
# تلاش برای پیدا کردن فرمت Y/M/D
|
| 68 |
+
ymd_match = re.match(r'(\d{1,4})/(\d{1,2})/(\d{1,2})', date_string)
|
| 69 |
+
if ymd_match:
|
| 70 |
+
year = int(ymd_match.group(1))
|
| 71 |
+
year += 1300
|
| 72 |
+
age = current_year - year
|
| 73 |
+
return age
|
| 74 |
+
# تلاش برای پیدا کردن عدد ۴ رقمی که با ۱۳ شروع میشود
|
| 75 |
+
four_digit_match = re.match(r'(13\d{2})', date_string)
|
| 76 |
+
if four_digit_match:
|
| 77 |
+
year = int(four_digit_match.group(1))
|
| 78 |
+
age = current_year - year
|
| 79 |
+
return age
|
| 80 |
+
return None
|
| 81 |
+
def extract_ner_info(text, nlp, fixed_loc):
|
| 82 |
ner_results = nlp(text)
|
| 83 |
full_name = ''
|
| 84 |
loc = ''
|
|
|
|
| 117 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
| 118 |
if age_match:
|
| 119 |
age = int(age_match.group(1))
|
| 120 |
+
else:
|
| 121 |
+
# تلاش برای پیدا کردن تاریخ تولد
|
| 122 |
+
date_match = re.search(r'(\d{1,4}/\d{1,2}/\d{1,2})', text)
|
| 123 |
+
if date_match:
|
| 124 |
+
age = calculate_age(date_match.group(1))
|
| 125 |
+
else:
|
| 126 |
+
# تلاش برای پیدا کردن عدد ۴ رقمی که با ۱۳ شروع میشود
|
| 127 |
+
four_digit_match = re.search(r'(13\d{2})', text)
|
| 128 |
+
if four_digit_match:
|
| 129 |
+
age = calculate_age(four_digit_match.group(1))
|
| 130 |
# بررسی امتیاز شباهت مکان
|
| 131 |
+
|
|
|
|
| 132 |
return full_name, loc, age
|
| 133 |
|
| 134 |
|
| 135 |
+
|
| 136 |
def process_text(input_text):
|
| 137 |
# مسیر فایل اکسلها را وارد کنید
|
| 138 |
job_excel_file_path = 'jobs_output.xlsx'
|