Spaces:
Sleeping
Sleeping
Atgriez uz versiju 2612aa5
Browse files
app.py
CHANGED
|
@@ -54,41 +54,16 @@ def extract_phone(text):
|
|
| 54 |
|
| 55 |
# Analīzes funkcijas
|
| 56 |
def analyze_experience(text):
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
experience_section = ""
|
| 60 |
-
lines = text.split('\n')
|
| 61 |
-
in_experience = False
|
| 62 |
-
in_education = False
|
| 63 |
-
|
| 64 |
-
for i, line in enumerate(lines):
|
| 65 |
-
line_lower = line.lower()
|
| 66 |
-
# Meklē darba pieredzes sākumu
|
| 67 |
-
if re.search(r'\b(employment|experience|work history|darba pieredze|professional experience)\b', line_lower):
|
| 68 |
-
in_experience = True
|
| 69 |
-
in_education = False
|
| 70 |
-
continue
|
| 71 |
-
# Apturās ja sākas izglītības sadaļa
|
| 72 |
-
if re.search(r'\b(education|izglītība)\b', line_lower):
|
| 73 |
-
in_education = True
|
| 74 |
-
in_experience = False
|
| 75 |
-
# Ja esam darba pieredzes sadaļā un ne izglītībā, pievienojam tekstu
|
| 76 |
-
if in_experience and not in_education:
|
| 77 |
-
experience_section += line + ' '
|
| 78 |
-
|
| 79 |
-
# Ja nekas nav atrasts, izmantojam visu tekstu
|
| 80 |
-
if not experience_section.strip():
|
| 81 |
-
experience_section = text
|
| 82 |
-
|
| 83 |
-
print(f"DEBUG: Experience section (first 200): {experience_section[:200]}")
|
| 84 |
-
|
| 85 |
-
# Meklē dažādus datumu formātus TIKAI darba pieredzes tekstā# Formāts 1: MM/YYYY to MM/YYYY vai MM/YYYY - MM/YYYY
|
| 86 |
pattern1 = r'(\d{1,2}[/.]\d{4})\s*(?:to\s+|-|–|—)\s*(\d{1,2}[/.]\d{4}|tagad|present|šobrīd)'
|
| 87 |
# Formāts 2: YYYY-YYYY vai YYYY - YYYY
|
| 88 |
pattern2 = r'(\d{4})\s*[-–—]\s*(\d{4}|tagad|present|šobrīd)'
|
| 89 |
|
| 90 |
# Meklē ar abiem formātiem
|
| 91 |
-
|
|
|
|
|
|
|
| 92 |
total_years = 0
|
| 93 |
|
| 94 |
# Apstrādā MM/YYYY formātu
|
|
@@ -115,7 +90,6 @@ def analyze_experience(text):
|
|
| 115 |
except:
|
| 116 |
continue
|
| 117 |
# Punktu skaits pēc pieredzes
|
| 118 |
-
print(f"DEBUG: total_years calculated = {total_years}")
|
| 119 |
if total_years >= 6:
|
| 120 |
exp_score = 30
|
| 121 |
elif total_years >= 4:
|
|
|
|
| 54 |
|
| 55 |
# Analīzes funkcijas
|
| 56 |
def analyze_experience(text):
|
| 57 |
+
# Meklē dažādus datumu formātus
|
| 58 |
+
# Formāts 1: MM/YYYY to MM/YYYY vai MM/YYYY - MM/YYYY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
pattern1 = r'(\d{1,2}[/.]\d{4})\s*(?:to\s+|-|–|—)\s*(\d{1,2}[/.]\d{4}|tagad|present|šobrīd)'
|
| 60 |
# Formāts 2: YYYY-YYYY vai YYYY - YYYY
|
| 61 |
pattern2 = r'(\d{4})\s*[-–—]\s*(\d{4}|tagad|present|šobrīd)'
|
| 62 |
|
| 63 |
# Meklē ar abiem formātiem
|
| 64 |
+
matches1 = re.findall(pattern1, text, re.IGNORECASE)
|
| 65 |
+
matches2 = re.findall(pattern2, text, re.IGNORECASE)
|
| 66 |
+
|
| 67 |
total_years = 0
|
| 68 |
|
| 69 |
# Apstrādā MM/YYYY formātu
|
|
|
|
| 90 |
except:
|
| 91 |
continue
|
| 92 |
# Punktu skaits pēc pieredzes
|
|
|
|
| 93 |
if total_years >= 6:
|
| 94 |
exp_score = 30
|
| 95 |
elif total_years >= 4:
|