added more preprocessings to cv_matcher
Browse files- project/cv_matcher.py +10 -8
project/cv_matcher.py
CHANGED
|
@@ -38,13 +38,15 @@ class CVMatcher:
|
|
| 38 |
|
| 39 |
# ----------- 1. Sector -----------
|
| 40 |
def preprocess_sector(self, sector):
|
| 41 |
-
|
| 42 |
-
if isinstance(sector,
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
output = " and ".join(
|
| 46 |
else:
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
return f"principal job sector: {output}"
|
| 49 |
|
| 50 |
def sector_similarity(self, offer_dict, cv_dict):
|
|
@@ -78,8 +80,8 @@ class CVMatcher:
|
|
| 78 |
|
| 79 |
# ----------- 2. Educaci贸n -----------
|
| 80 |
def preprocess_field(self, field):
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
|
| 85 |
def education_similarity(self, offer_dict, cv_education):
|
|
|
|
| 38 |
|
| 39 |
# ----------- 1. Sector -----------
|
| 40 |
def preprocess_sector(self, sector):
|
| 41 |
+
# Primero, manejamos el caso de que sea una lista
|
| 42 |
+
if isinstance(sector, list):
|
| 43 |
+
# Nos aseguramos de que cada elemento de la lista sea un string antes de unir
|
| 44 |
+
processed_list = [str(s).lower().strip() for s in sector]
|
| 45 |
+
output = " and ".join(processed_list)
|
| 46 |
else:
|
| 47 |
+
# Para todo lo dem谩s (str, int, float, None), lo convertimos a string PRIMERO
|
| 48 |
+
output = str(sector).lower().strip().replace(",", " and")
|
| 49 |
+
|
| 50 |
return f"principal job sector: {output}"
|
| 51 |
|
| 52 |
def sector_similarity(self, offer_dict, cv_dict):
|
|
|
|
| 80 |
|
| 81 |
# ----------- 2. Educaci贸n -----------
|
| 82 |
def preprocess_field(self, field):
|
| 83 |
+
# Forzamos la conversi贸n a string ANTES de hacer cualquier otra cosa
|
| 84 |
+
return f"field of study: {str(field).lower().strip().replace(',', ' and')}"
|
| 85 |
|
| 86 |
|
| 87 |
def education_similarity(self, offer_dict, cv_education):
|