Vincent Claes commited on
Commit
1ba9479
1 Parent(s): df97380

check more meticulously the matches

Browse files
Files changed (2) hide show
  1. app.py +13 -5
  2. skills.py +14 -6
app.py CHANGED
@@ -43,7 +43,7 @@ def postprocess_vancy(vacancies, resume):
43
  html_table = "<table>"
44
 
45
  # Add table headers
46
- html_table += "<tr><th>Vacancy</th><th>Score</th><th>Skills Match</th></tr>"
47
 
48
  # Prepare a list to hold the futures
49
  futures = []
@@ -63,14 +63,22 @@ def postprocess_vancy(vacancies, resume):
63
  skills_match_predicted = utils.get_json_list_from_result(
64
  skills_match, "skills_match_predicted"
65
  )
66
- for skill in skills_match_predicted:
 
 
 
 
 
 
67
  vacancy = vacancy.lower().replace(
68
- skill.lower(),
69
- f'<span style="background-color: yellow;">{skill}</span>',
70
  )
71
  formatted_vacancy = vacancy.replace(".,", "<br/>")
72
  formatted_vacancy = f"VACATURE {i + 1}:<br/>{formatted_vacancy}"
73
- html_table += f"<tr><td>{formatted_vacancy}</td><td>{len(skills_match_predicted)}</td><td>{', '.join(skills_match_predicted)}</td></tr>"
 
 
74
  html_table += "</table>"
75
  return html_table
76
 
 
43
  html_table = "<table>"
44
 
45
  # Add table headers
46
+ html_table += "<tr><th>Vacancy</th><th>Skills Match</th></tr>"
47
 
48
  # Prepare a list to hold the futures
49
  futures = []
 
63
  skills_match_predicted = utils.get_json_list_from_result(
64
  skills_match, "skills_match_predicted"
65
  )
66
+ print("getting matched skills ...")
67
+ matched_skills = [
68
+ element["content"]
69
+ for element in skills_match_predicted
70
+ if element["resume_index"] > 0 and element["vacancy_index"] > 0
71
+ ]
72
+ for element in matched_skills:
73
  vacancy = vacancy.lower().replace(
74
+ element.lower(),
75
+ f'<span style="background-color: yellow;">{element}</span>',
76
  )
77
  formatted_vacancy = vacancy.replace(".,", "<br/>")
78
  formatted_vacancy = f"VACATURE {i + 1}:<br/>{formatted_vacancy}"
79
+ matches = "<br/> - ".join(matched_skills)
80
+ macthes_formatted = f"Score: {len(matched_skills)}<br/>-{matches}"
81
+ html_table += f"<tr><td>{formatted_vacancy}</td><td>{macthes_formatted}</td></tr>"
82
  html_table += "</table>"
83
  return html_table
84
 
skills.py CHANGED
@@ -107,15 +107,23 @@ def get_skills_match(llm, vacancy, resume) -> SequentialChain:
107
  {vacancy}
108
  ```
109
 
110
- Can you list the matches concerning skills between the vacancy above delimited by three backticks with the resume below delimited by three backticks.
111
- Consider skills that are not exact but are close to each other.
112
- Provide maximum 7 skills and the most required skills first.
113
- If no skills match do not make up a response and return an empty list.
114
- Return the matches as a JSON list on 1 line, do not add newlines or any other text.
115
-
116
  ```
117
  {resume}
118
  ```
 
 
 
 
 
 
 
 
 
119
  """
120
 
121
  prompt_get_skills_intersection = ChatPromptTemplate.from_template(
 
107
  {vacancy}
108
  ```
109
 
110
+ Can you list any matches you can find in both the vacancy above delimited by three backticks and the resume below delimited by three backticks.
111
+ Look for job specific content, experience and location.
112
+ If there is no match at all, do not make up a response and return an empty list.
113
+ Make sure the a match occurs in both resume and vacancy.
114
+
 
115
  ```
116
  {resume}
117
  ```
118
+
119
+ Return the matches as a JSON list where each element of the list is the following JSON object:
120
+
121
+ "content" : <the matched content like it occured in the vacancy>,
122
+ "resume_index" : <the number of times the match occured in the resume>,
123
+ "vacancy_index" : <the number of times the match occured in the vacancy>
124
+
125
+
126
+ Return the JSON list with no new lines or any other text.
127
  """
128
 
129
  prompt_get_skills_intersection = ChatPromptTemplate.from_template(