1000jaus commited on
Commit
9f49fc5
1 Parent(s): ffe8327

added more preprocessings to cv_matcher

Browse files
Files changed (1) hide show
  1. 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
- self._load_model()
42
- if isinstance(sector, str):
43
- output = sector.lower().strip().replace(",", " and")
44
- elif isinstance(sector, list):
45
- output = " and ".join([s.lower().strip() for s in sector])
46
  else:
47
- output = ""
 
 
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
- self._load_model()
82
- return f"field of study: {field.lower().strip().replace(',', ' and')}"
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):