skill_roadmap_app / recommender.py
Danial7's picture
Create recommender.py
6dc350b verified
import pandas as pd
def score_skills(user_skills, skills_df):
return int((len(user_skills) / len(skills_df)) * 100)
def classify_field(text, field_labels):
# Replace with a transformer model if needed
for field in field_labels:
if field.lower() in text.lower():
return field
return "General"
def recommend_countries(user_skills, countries_df):
return countries_df[countries_df["Skill"].isin(user_skills)].drop_duplicates()
def recommend_certifications(user_skills, cert_df):
return cert_df[cert_df["Skill"].isin(user_skills)].drop_duplicates()
def recommend_education(background, edu_tech_df, edu_non_tech_df):
return edu_tech_df if background == "technical" else edu_non_tech_df
def generate_roadmap(cv_data, field, score, country_jobs, certs, scholarships):
roadmap = f"""
## πŸ“ Your Personalized Career Roadmap
- **Field**: {field}
- **Skill Score**: {score}/100
- **Years of Experience**: {cv_data['years_experience']}
### 🌍 Country-Based Job Opportunities:
{country_jobs.to_markdown(index=False) if not country_jobs.empty else 'No matching jobs found.'}
### πŸŽ“ Recommended Certifications:
{certs.to_markdown(index=False) if not certs.empty else 'None found.'}
### πŸŽ“ Suggested Scholarships:
{scholarships.to_markdown(index=False) if not scholarships.empty else 'None found.'}
### 🧭 Next Steps:
- Improve missing skills.
- Pursue listed certifications.
- Apply to the recommended countries.
- Consider higher education if needed.
"""
return roadmap