Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,7 +57,7 @@ def check_ats_friendly(text):
|
|
| 57 |
|
| 58 |
return score, suggestions
|
| 59 |
|
| 60 |
-
# Function to calculate job fit score
|
| 61 |
def calculate_job_fit_score(resume_text, job_description):
|
| 62 |
resume_words = Counter(resume_text.lower().split())
|
| 63 |
job_words = Counter(job_description.lower().split())
|
|
@@ -65,6 +65,7 @@ def calculate_job_fit_score(resume_text, job_description):
|
|
| 65 |
# Find overlap between resume and job description keywords
|
| 66 |
common_words = resume_words & job_words
|
| 67 |
total_job_words = sum(job_words.values())
|
|
|
|
| 68 |
|
| 69 |
# Calculate match percentage
|
| 70 |
if total_job_words == 0:
|
|
@@ -73,12 +74,12 @@ def calculate_job_fit_score(resume_text, job_description):
|
|
| 73 |
match_percentage = sum(common_words.values()) / total_job_words * 100
|
| 74 |
|
| 75 |
suggestions = []
|
| 76 |
-
if match_percentage <
|
| 77 |
suggestions.append(
|
| 78 |
-
"
|
| 79 |
)
|
| 80 |
|
| 81 |
-
return match_percentage, suggestions
|
| 82 |
|
| 83 |
# Main App
|
| 84 |
def main():
|
|
@@ -122,7 +123,7 @@ def main():
|
|
| 122 |
# Analyze Job Fit
|
| 123 |
if job_description.strip():
|
| 124 |
st.subheader("Job Description Matching")
|
| 125 |
-
job_fit_score, job_fit_suggestions = calculate_job_fit_score(
|
| 126 |
resume_text, job_description
|
| 127 |
)
|
| 128 |
st.metric("Job Fit Score", f"{job_fit_score:.2f}%")
|
|
@@ -139,5 +140,12 @@ def main():
|
|
| 139 |
else:
|
| 140 |
st.write("No specific suggestions. Great match!")
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
if __name__ == "__main__":
|
| 143 |
main()
|
|
|
|
| 57 |
|
| 58 |
return score, suggestions
|
| 59 |
|
| 60 |
+
# Function to calculate job fit score and recommend missing keywords
|
| 61 |
def calculate_job_fit_score(resume_text, job_description):
|
| 62 |
resume_words = Counter(resume_text.lower().split())
|
| 63 |
job_words = Counter(job_description.lower().split())
|
|
|
|
| 65 |
# Find overlap between resume and job description keywords
|
| 66 |
common_words = resume_words & job_words
|
| 67 |
total_job_words = sum(job_words.values())
|
| 68 |
+
missing_keywords = set(job_words.keys()) - set(resume_words.keys())
|
| 69 |
|
| 70 |
# Calculate match percentage
|
| 71 |
if total_job_words == 0:
|
|
|
|
| 74 |
match_percentage = sum(common_words.values()) / total_job_words * 100
|
| 75 |
|
| 76 |
suggestions = []
|
| 77 |
+
if match_percentage < 100:
|
| 78 |
suggestions.append(
|
| 79 |
+
"Consider including the missing keywords in your resume to improve matching."
|
| 80 |
)
|
| 81 |
|
| 82 |
+
return match_percentage, suggestions, missing_keywords
|
| 83 |
|
| 84 |
# Main App
|
| 85 |
def main():
|
|
|
|
| 123 |
# Analyze Job Fit
|
| 124 |
if job_description.strip():
|
| 125 |
st.subheader("Job Description Matching")
|
| 126 |
+
job_fit_score, job_fit_suggestions, missing_keywords = calculate_job_fit_score(
|
| 127 |
resume_text, job_description
|
| 128 |
)
|
| 129 |
st.metric("Job Fit Score", f"{job_fit_score:.2f}%")
|
|
|
|
| 140 |
else:
|
| 141 |
st.write("No specific suggestions. Great match!")
|
| 142 |
|
| 143 |
+
# Recommend missing keywords
|
| 144 |
+
if missing_keywords:
|
| 145 |
+
st.subheader("Recommended Keywords to Add for 100% Match")
|
| 146 |
+
st.write(", ".join(missing_keywords))
|
| 147 |
+
else:
|
| 148 |
+
st.write("Your resume already includes all the required keywords!")
|
| 149 |
+
|
| 150 |
if __name__ == "__main__":
|
| 151 |
main()
|