Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -315,11 +315,74 @@ def summarize_resume_text(resume_text):
|
|
315 |
#####################################
|
316 |
def analyze_google_fit(resume_summary):
|
317 |
"""
|
318 |
-
Analyze how well the candidate fits Google's requirements.
|
319 |
-
Only modifying the T5 prompt to get better expert assessments.
|
320 |
"""
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
# Get more specific information for a better prompt
|
324 |
# Get top skills across all categories (up to 5 total)
|
325 |
all_matching_skills = []
|
|
|
315 |
#####################################
|
316 |
def analyze_google_fit(resume_summary):
|
317 |
"""
|
318 |
+
Analyze how well the candidate fits Google's requirements with detailed category breakdowns.
|
|
|
319 |
"""
|
320 |
+
start_time = time.time()
|
321 |
+
|
322 |
+
# Define Google's key skill categories with more detailed keywords
|
323 |
+
google_keywords = {
|
324 |
+
"technical_skills": ["python", "java", "c++", "javascript", "go", "sql", "algorithms", "data structures",
|
325 |
+
"coding", "software development", "git", "programming", "backend", "frontend", "full-stack"],
|
326 |
+
"advanced_tech": ["machine learning", "ai", "artificial intelligence", "cloud", "data science", "big data",
|
327 |
+
"tensorflow", "deep learning", "distributed systems", "kubernetes", "microservices"],
|
328 |
+
"problem_solving": ["problem solving", "analytical", "critical thinking", "troubleshooting", "debugging",
|
329 |
+
"optimization", "scalability", "system design", "complexity", "efficiency"],
|
330 |
+
"innovation": ["innovation", "creative", "creativity", "design thinking", "research", "novel solutions",
|
331 |
+
"patents", "publications", "unique approaches", "cutting-edge"],
|
332 |
+
"soft_skills": ["team", "leadership", "collaboration", "communication", "agile", "project management",
|
333 |
+
"mentoring", "cross-functional", "presentation", "stakeholder management"]
|
334 |
+
}
|
335 |
+
|
336 |
+
# Category weights with descriptive labels
|
337 |
+
category_weights = {
|
338 |
+
"technical_skills": {"weight": 0.35, "label": "Technical Programming Skills"},
|
339 |
+
"advanced_tech": {"weight": 0.25, "label": "Advanced Technology Knowledge"},
|
340 |
+
"problem_solving": {"weight": 0.20, "label": "Problem Solving Abilities"},
|
341 |
+
"innovation": {"weight": 0.10, "label": "Innovation Mindset"},
|
342 |
+
"soft_skills": {"weight": 0.10, "label": "Collaboration & Leadership"}
|
343 |
+
}
|
344 |
+
|
345 |
+
resume_lower = resume_summary.lower()
|
346 |
|
347 |
+
# Calculate category scores and store detailed information
|
348 |
+
category_scores = {}
|
349 |
+
category_details = {}
|
350 |
+
found_skills = {}
|
351 |
+
|
352 |
+
for category, keywords in google_keywords.items():
|
353 |
+
# Find the specific matching keywords for feedback
|
354 |
+
category_matches = [keyword for keyword in keywords if keyword in resume_lower]
|
355 |
+
found_skills[category] = category_matches
|
356 |
+
|
357 |
+
# Count matches but cap at a reasonable level
|
358 |
+
matches = len(category_matches)
|
359 |
+
total_keywords = len(keywords)
|
360 |
+
|
361 |
+
# Calculate raw percentage for this category
|
362 |
+
raw_percentage = int((matches / total_keywords) * 100)
|
363 |
+
|
364 |
+
# Apply logarithmic scaling for more realistic scores
|
365 |
+
if matches == 0:
|
366 |
+
adjusted_score = 0.0
|
367 |
+
else:
|
368 |
+
# Logarithmic scaling to prevent perfect scores
|
369 |
+
adjusted_score = min(0.95, (math.log(matches + 1) / math.log(min(total_keywords, 8) + 1)))
|
370 |
+
|
371 |
+
# Store both raw and adjusted scores for feedback
|
372 |
+
category_scores[category] = adjusted_score
|
373 |
+
category_details[category] = {
|
374 |
+
"raw_percentage": raw_percentage,
|
375 |
+
"adjusted_score": int(adjusted_score * 100),
|
376 |
+
"matching_keywords": category_matches,
|
377 |
+
"total_keywords": total_keywords,
|
378 |
+
"matches": matches
|
379 |
+
}
|
380 |
+
|
381 |
+
# Calculate weighted score
|
382 |
+
weighted_score = sum(score * category_weights[category]["weight"] for category, score in category_scores.items())
|
383 |
+
|
384 |
+
# Apply final curve to keep scores in a realistic range
|
385 |
+
match_percentage = min(92, max(35, int(weighted_score * 100)))
|
386 |
# Get more specific information for a better prompt
|
387 |
# Get top skills across all categories (up to 5 total)
|
388 |
all_matching_skills = []
|