Spaces:
Sleeping
Sleeping
Edvin Behdadijd
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,10 +80,17 @@ def extract_ner_info(text, nlp):
|
|
| 80 |
i = j # به موقعیت جدید برو
|
| 81 |
else:
|
| 82 |
break
|
| 83 |
-
# جمعآوری قطعات I-fac برای مکان
|
| 84 |
-
if ner_results[i]['entity'] == 'I-fac' and not loc:
|
| 85 |
-
loc = ner_results[i]['word']
|
| 86 |
i += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
# استخراج سن از متن
|
| 88 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
| 89 |
if age_match:
|
|
|
|
| 80 |
i = j # به موقعیت جدید برو
|
| 81 |
else:
|
| 82 |
break
|
|
|
|
|
|
|
|
|
|
| 83 |
i += 1
|
| 84 |
+
# جمعآوری مکانها با امتیاز بالای ۸۰
|
| 85 |
+
for entity in ner_results:
|
| 86 |
+
if entity['entity'] == 'I-fac' and entity['score'] >= 0.80:
|
| 87 |
+
if loc:
|
| 88 |
+
loc += ' '
|
| 89 |
+
loc += entity['word']
|
| 90 |
+
# استخراج سن از متن
|
| 91 |
+
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
| 92 |
+
if age_match:
|
| 93 |
+
age = int(age_match.group(1))
|
| 94 |
# استخراج سن از متن
|
| 95 |
age_match = re.search(r'سن\s*:\s*(\d+)', text)
|
| 96 |
if age_match:
|