Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,15 +69,15 @@ def extract_ner_info(text, nlp):
|
|
69 |
age = None
|
70 |
|
71 |
for i in range(len(ner_results)):
|
72 |
-
if ner_results[i]['entity'] == 'B-
|
73 |
full_name = ner_results[i]['word']
|
74 |
for j in range(i+1, len(ner_results)):
|
75 |
-
if ner_results[j]['entity'].startswith('I-
|
76 |
full_name += ner_results[j]['word'].replace('##', '')
|
77 |
else:
|
78 |
break
|
79 |
|
80 |
-
if ner_results[i]['entity'] == '
|
81 |
loc = ner_results[i]['word']
|
82 |
|
83 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
@@ -86,6 +86,7 @@ def extract_ner_info(text, nlp):
|
|
86 |
|
87 |
return full_name, loc, age
|
88 |
|
|
|
89 |
def process_text(input_text):
|
90 |
# مسیر فایل اکسلها را وارد کنید
|
91 |
job_excel_file_path = 'jobs_output.xlsx'
|
@@ -167,7 +168,7 @@ def process_text(input_text):
|
|
167 |
skill_score, common_skills = compare_skills(skills_in_fixed_text, skills_in_input_text)
|
168 |
|
169 |
# تنظیم و آمادهسازی مدل NER
|
170 |
-
model_name_or_path = "
|
171 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
172 |
model = AutoModelForTokenClassification.from_pretrained(model_name_or_path) # Pytorch
|
173 |
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
|
|
69 |
age = None
|
70 |
|
71 |
for i in range(len(ner_results)):
|
72 |
+
if ner_results[i]['entity'] == 'B-pers':
|
73 |
full_name = ner_results[i]['word']
|
74 |
for j in range(i+1, len(ner_results)):
|
75 |
+
if ner_results[j]['entity'].startswith('I-pers'):
|
76 |
full_name += ner_results[j]['word'].replace('##', '')
|
77 |
else:
|
78 |
break
|
79 |
|
80 |
+
if ner_results[i]['entity'] == 'I-fac' and not loc:
|
81 |
loc = ner_results[i]['word']
|
82 |
|
83 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
|
|
86 |
|
87 |
return full_name, loc, age
|
88 |
|
89 |
+
|
90 |
def process_text(input_text):
|
91 |
# مسیر فایل اکسلها را وارد کنید
|
92 |
job_excel_file_path = 'jobs_output.xlsx'
|
|
|
168 |
skill_score, common_skills = compare_skills(skills_in_fixed_text, skills_in_input_text)
|
169 |
|
170 |
# تنظیم و آمادهسازی مدل NER
|
171 |
+
model_name_or_path = "NLPclass/Named-entity-recognition"
|
172 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
173 |
model = AutoModelForTokenClassification.from_pretrained(model_name_or_path) # Pytorch
|
174 |
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|