Danial7 commited on
Commit
6dc350b
·
verified ·
1 Parent(s): 0cb6239

Create recommender.py

Browse files
Files changed (1) hide show
  1. recommender.py +46 -0
recommender.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def score_skills(user_skills, skills_df):
4
+ return int((len(user_skills) / len(skills_df)) * 100)
5
+
6
+ def classify_field(text, field_labels):
7
+ # Replace with a transformer model if needed
8
+ for field in field_labels:
9
+ if field.lower() in text.lower():
10
+ return field
11
+ return "General"
12
+
13
+ def recommend_countries(user_skills, countries_df):
14
+ return countries_df[countries_df["Skill"].isin(user_skills)].drop_duplicates()
15
+
16
+ def recommend_certifications(user_skills, cert_df):
17
+ return cert_df[cert_df["Skill"].isin(user_skills)].drop_duplicates()
18
+
19
+ def recommend_education(background, edu_tech_df, edu_non_tech_df):
20
+ return edu_tech_df if background == "technical" else edu_non_tech_df
21
+
22
+ def generate_roadmap(cv_data, field, score, country_jobs, certs, scholarships):
23
+ roadmap = f"""
24
+ ## 📍 Your Personalized Career Roadmap
25
+
26
+ - **Field**: {field}
27
+ - **Skill Score**: {score}/100
28
+ - **Years of Experience**: {cv_data['years_experience']}
29
+
30
+ ### 🌍 Country-Based Job Opportunities:
31
+ {country_jobs.to_markdown(index=False) if not country_jobs.empty else 'No matching jobs found.'}
32
+
33
+ ### 🎓 Recommended Certifications:
34
+ {certs.to_markdown(index=False) if not certs.empty else 'None found.'}
35
+
36
+ ### 🎓 Suggested Scholarships:
37
+ {scholarships.to_markdown(index=False) if not scholarships.empty else 'None found.'}
38
+
39
+ ### 🧭 Next Steps:
40
+ - Improve missing skills.
41
+ - Pursue listed certifications.
42
+ - Apply to the recommended countries.
43
+ - Consider higher education if needed.
44
+
45
+ """
46
+ return roadmap