Spaces:
Sleeping
Sleeping
| # -*- coding: utf-8 -*- | |
| """ | |
| Complete Standalone Resume Matcher for Google Colab | |
| No external dependencies required - just paste and run! | |
| UPDATED with new roles as requested. | |
| """ | |
| import gradio as gr | |
| import json | |
| import re | |
| from datetime import datetime | |
| from typing import Tuple, List, Dict, Any | |
| from collections import Counter | |
| import math | |
| class TextProfileParser: | |
| """Simple text profile parser.""" | |
| def parse(self, profile_text: str) -> Dict: | |
| """Parse profile text into structured data.""" | |
| sections = { | |
| "education": [], | |
| "experience": [], | |
| "skills": [], | |
| "projects": [], | |
| "achievements": [], | |
| "certificates": [] | |
| } | |
| lines = profile_text.split('\n') | |
| current_section = None | |
| for line in lines: | |
| line = line.strip() | |
| if not line: | |
| continue | |
| # Detect section headers | |
| line_lower = line.lower() | |
| if any(keyword in line_lower for keyword in ['education', 'academic']): | |
| current_section = 'education' | |
| elif any(keyword in line_lower for keyword in ['experience', 'work', 'employment']): | |
| current_section = 'experience' | |
| elif any(keyword in line_lower for keyword in ['skill', 'technical', 'competenc']): | |
| current_section = 'skills' | |
| elif any(keyword in line_lower for keyword in ['project', 'portfolio']): | |
| current_section = 'projects' | |
| elif any(keyword in line_lower for keyword in ['achievement', 'award', 'honor', 'certificate']): | |
| current_section = 'achievements' | |
| elif current_section and line: | |
| sections[current_section].append(line) | |
| return sections | |
| class StandaloneResumeMatcherApp: | |
| """Complete standalone resume matcher with no external dependencies.""" | |
| def __init__(self): | |
| print("Initializing Standalone Resume Matcher for Google Colab...") | |
| # Initialize basic components | |
| self.text_profile_parser = TextProfileParser() | |
| # Create comprehensive role database | |
| self.role_database = self._create_comprehensive_role_database() | |
| # Create skill database for better matching | |
| self.skill_database = self._create_skill_database() | |
| print("β Standalone application initialized successfully!") | |
| def _create_comprehensive_role_database(self): | |
| """Create a comprehensive role database with detailed information.""" | |
| return { | |
| # Analytics Category | |
| "Business Analytics": { | |
| "category": "Analytics", | |
| "domain": "analytics", | |
| "required_skills": ["SQL", "Excel", "Python", "Tableau", "Power BI", "Statistics", "Data Analysis", "Business Intelligence", "KPI", "Dashboard"], | |
| "description": "Analyze business data to identify trends, patterns, and insights that drive strategic decision-making.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["analytics", "business intelligence", "dashboard", "kpi", "metrics", "reporting", "data analysis", "insights", "visualization"], | |
| "responsibilities": ["Create dashboards", "Analyze KPIs", "Generate reports", "Data visualization", "Business insights"], | |
| "salary_range": "$70,000 - $120,000" | |
| }, | |
| "Data Visualisation": { | |
| "category": "Analytics", | |
| "domain": "analytics", | |
| "required_skills": ["Tableau", "Power BI", "D3.js", "Python", "R", "SQL", "Data Storytelling", "Dashboard Design", "Looker"], | |
| "description": "Create compelling visual representations of data to communicate insights effectively to stakeholders.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["visualization", "dashboard", "charts", "graphs", "storytelling", "tableau", "power bi", "design", "infographics"], | |
| "responsibilities": ["Design dashboards", "Create visualizations", "Data storytelling", "User experience design"], | |
| "salary_range": "$65,000 - $110,000" | |
| }, | |
| # Retained Data Scientist as it's a key role in Analytics | |
| "Data Scientist": { | |
| "category": "Analytics", | |
| "domain": "data_science", | |
| "required_skills": ["Python", "Machine Learning", "Statistics", "SQL", "Pandas", "Scikit-learn", "TensorFlow", "PyTorch", "Predictive Modeling"], | |
| "description": "Build predictive models and analyze complex datasets to extract actionable insights.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["machine learning", "data science", "predictive modeling", "algorithms", "statistical analysis", "deep learning"], | |
| "responsibilities": ["Model development", "Data analysis", "Algorithm design", "Statistical modeling", "Research"], | |
| "salary_range": "$90,000 - $160,000" | |
| }, | |
| # Capital Markets Category | |
| "Equity Research": { | |
| "category": "Capital Markets", | |
| "domain": "finance", | |
| "required_skills": ["Financial Modeling", "Valuation", "Excel", "Bloomberg Terminal", "Equity Analysis", "DCF", "Comparable Analysis", "Financial Statements"], | |
| "description": "Analyze equity securities and provide investment recommendations based on fundamental analysis.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["equity", "research", "valuation", "stocks", "investment", "analysis", "financial modeling"], | |
| "responsibilities": ["Company analysis", "Financial modeling", "Investment recommendations", "Research reports"], | |
| "salary_range": "$80,000 - $150,000" | |
| }, | |
| "Investment Banking": { | |
| "category": "Capital Markets", | |
| "domain": "finance", | |
| "required_skills": ["Financial Modeling", "Valuation", "M&A", "Excel", "PowerPoint", "Bloomberg", "Due Diligence", "Pitch Books", "LBO Modeling"], | |
| "description": "Provide financial advisory services for mergers, acquisitions, and capital raising.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["investment banking", "m&a", "ipo", "capital markets", "advisory", "valuation", "financing"], | |
| "responsibilities": ["M&A advisory", "Capital raising", "Financial modeling", "Pitch preparation", "Due diligence"], | |
| "salary_range": "$100,000 - $200,000" | |
| }, | |
| "Risk Management": { | |
| "category": "Capital Markets", | |
| "domain": "finance", | |
| "required_skills": ["Risk Analysis", "VaR", "Monte Carlo", "Python", "R", "Excel", "Derivatives", "Credit Risk", "Market Risk"], | |
| "description": "Identify, assess, and mitigate financial risks across trading, credit, and operational activities.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["risk", "var", "credit risk", "market risk", "compliance", "derivatives", "hedging"], | |
| "responsibilities": ["Risk assessment", "Model development", "Regulatory reporting", "Portfolio monitoring", "Stress testing"], | |
| "salary_range": "$90,000 - $160,000" | |
| }, | |
| # Corporate Finance Category (New Category from Image) | |
| "Business Finance": { | |
| "category": "Corporate Finance", | |
| "domain": "finance", | |
| "required_skills": ["FP&A", "Budgeting", "Forecasting", "Financial Modeling", "Variance Analysis", "Excel", "PowerPoint", "SAP"], | |
| "description": "Act as a financial partner to business units, providing insights, analysis, and guidance to support strategic goals.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["fp&a", "financial planning", "business partner", "budget", "forecast", "analysis"], | |
| "responsibilities": ["Financial planning and analysis", "Budget management", "Performance reporting", "Strategic support"], | |
| "salary_range": "$75,000 - $125,000" | |
| }, | |
| "Corporate Finance": { | |
| "category": "Corporate Finance", | |
| "domain": "finance", | |
| "required_skills": ["Financial Modeling", "Valuation", "M&A", "Excel", "Capital Structure", "Treasury", "Financial Planning", "Investment Analysis"], | |
| "description": "Manage corporate financial strategy, capital structure, and major financial transactions like M&A.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["corporate finance", "capital structure", "treasury", "m&a", "valuation", "strategy", "financing"], | |
| "responsibilities": ["Capital planning", "M&A analysis", "Treasury management", "Financial strategy", "Investor relations"], | |
| "salary_range": "$85,000 - $150,000" | |
| }, | |
| "Financial Operations": { | |
| "category": "Corporate Finance", | |
| "domain": "finance", | |
| "required_skills": ["Accounts Payable", "Accounts Receivable", "Reconciliation", "ERP Systems", "Process Improvement", "Internal Controls", "Month-End Close"], | |
| "description": "Oversee and manage the daily financial operations of a company, including accounting, billing, and payments.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["finops", "accounts payable", "receivable", "reconciliation", "erp", "sap", "oracle"], | |
| "responsibilities": ["Manage AP/AR", "Perform bank reconciliations", "Improve financial processes", "Ensure accurate transactions"], | |
| "salary_range": "$65,000 - $100,000" | |
| }, | |
| "Tax and Accounting": { | |
| "category": "Corporate Finance", | |
| "domain": "finance", | |
| "required_skills": ["GAAP", "IFRS", "Tax Compliance", "Auditing", "Financial Reporting", "Corporate Tax", "Excel", "CPA"], | |
| "description": "Manage all aspects of accounting and tax compliance, ensuring accurate financial reporting and adherence to regulations.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["tax", "accounting", "audit", "compliance", "gaap", "ifrs", "cpa", "financial statements"], | |
| "responsibilities": ["Tax planning and filing", "Financial statement preparation", "Internal and external audits", "Regulatory compliance"], | |
| "salary_range": "$80,000 - $140,000" | |
| }, | |
| # Human Resources Category | |
| "HR Generalist": { | |
| "category": "Human Resources", | |
| "domain": "hr", | |
| "required_skills": ["Recruitment", "Employee Relations", "HRIS", "Training", "Compliance", "Performance Management", "Benefits Administration"], | |
| "description": "Manage various HR functions including recruitment, employee relations, and policy implementation.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["human resources", "recruitment", "employee relations", "training", "compliance", "hr", "hiring"], | |
| "responsibilities": ["Recruitment", "Employee relations", "Training coordination", "Policy implementation", "Compliance"], | |
| "salary_range": "$55,000 - $85,000" | |
| }, | |
| "Talent Acquisition": { | |
| "category": "Human Resources", | |
| "domain": "hr", | |
| "required_skills": ["Recruiting", "Sourcing", "Interviewing", "ATS", "LinkedIn Recruiter", "Boolean Search", "Employer Branding", "Candidate Experience"], | |
| "description": "Source, attract, and hire top talent through strategic recruitment and talent acquisition strategies.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["recruiting", "talent acquisition", "sourcing", "hiring", "candidates", "interviews", "ats", "linkedin"], | |
| "responsibilities": ["Candidate sourcing", "Interview coordination", "Talent pipeline management", "Employer branding"], | |
| "salary_range": "$60,000 - $95,000" | |
| }, | |
| # Marketing Category | |
| "Category Management": { | |
| "category": "Marketing", | |
| "domain": "marketing", | |
| "required_skills": ["Market Analysis", "Product Assortment", "Pricing Strategy", "Vendor Management", "P&L Management", "Consumer Insights", "Nielsen/IRI"], | |
| "description": "Manage a product category as a strategic business unit, responsible for its pricing, promotion, and profitability.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["category management", "product assortment", "pricing", "vendor relations", "p&l", "merchandising"], | |
| "responsibilities": ["Develop category strategy", "Manage vendor relationships", "Optimize product mix", "Analyze sales data"], | |
| "salary_range": "$85,000 - $140,000" | |
| }, | |
| "Digital Marketing": { | |
| "category": "Marketing", | |
| "domain": "marketing", | |
| "required_skills": ["SEO", "SEM", "Google Analytics", "Social Media", "Content Marketing", "PPC", "Email Marketing", "Google Ads"], | |
| "description": "Develop and execute digital marketing campaigns across online channels to drive brand awareness and conversions.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["digital marketing", "seo", "sem", "social media", "google ads", "content marketing", "ppc", "email"], | |
| "responsibilities": ["Campaign management", "SEO optimization", "Social media strategy", "Content creation", "Analytics"], | |
| "salary_range": "$55,000 - $95,000" | |
| }, | |
| "Market Research": { | |
| "category": "Marketing", | |
| "domain": "marketing", | |
| "required_skills": ["Survey Design", "Statistical Analysis", "SPSS", "R", "Excel", "Focus Groups", "Consumer Insights", "Competitive Analysis"], | |
| "description": "Conduct market research to understand consumer behavior, market trends, and competitive landscape.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["market research", "surveys", "consumer insights", "analysis", "trends", "competitive intelligence"], | |
| "responsibilities": ["Research design", "Data collection", "Statistical analysis", "Insights generation", "Report presentation"], | |
| "salary_range": "$60,000 - $100,000" | |
| }, | |
| "Marketing Management": { | |
| "category": "Marketing", | |
| "domain": "marketing", | |
| "required_skills": ["Marketing Strategy", "Brand Management", "Campaign Management", "Budgeting", "Team Leadership", "Market Analysis", "Go-to-Market Strategy"], | |
| "description": "Lead the marketing department by developing and implementing comprehensive marketing strategies to increase brand awareness and drive sales.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["marketing manager", "brand management", "strategy", "campaigns", "leadership", "gtm"], | |
| "responsibilities": ["Develop marketing plans", "Manage marketing budget", "Lead marketing team", "Oversee brand strategy"], | |
| "salary_range": "$90,000 - $160,000" | |
| }, | |
| "Performance Marketing": { | |
| "category": "Marketing", | |
| "domain": "marketing", | |
| "required_skills": ["Paid Advertising", "Google Ads", "Facebook Ads", "Analytics", "Conversion Tracking", "A/B Testing", "ROI Analysis", "Attribution Modeling"], | |
| "description": "Drive measurable marketing results through data-driven paid advertising and performance optimization.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["performance marketing", "paid ads", "roi", "conversion", "optimization", "attribution", "programmatic"], | |
| "responsibilities": ["Campaign optimization", "Performance analysis", "A/B testing", "Budget allocation", "ROI maximization"], | |
| "salary_range": "$65,000 - $110,000" | |
| }, | |
| # Operations Category | |
| "Customer Success": { | |
| "category": "Operations", | |
| "domain": "operations", | |
| "required_skills": ["Customer Relationship Management", "CRM", "Account Management", "Communication", "Problem Solving", "Retention Strategy", "Onboarding"], | |
| "description": "Ensure customer satisfaction, retention, and growth through proactive relationship management and support.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["customer success", "retention", "account management", "onboarding", "satisfaction", "growth", "relationships"], | |
| "responsibilities": ["Customer onboarding", "Relationship management", "Retention strategies", "Success metrics", "Account growth"], | |
| "salary_range": "$60,000 - $100,000" | |
| }, | |
| "Service Operations": { | |
| "category": "Operations", | |
| "domain": "operations", | |
| "required_skills": ["ITIL", "Service Delivery", "Incident Management", "Problem Management", "SLA Management", "ServiceNow", "Process Improvement"], | |
| "description": "Manage the end-to-end delivery of IT services to business users, ensuring stability, quality, and adherence to SLAs.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["service delivery", "itil", "sla", "incident management", "operations", "servicenow"], | |
| "responsibilities": ["Oversee incident resolution", "Manage service level agreements", "Improve operational processes", "Coordinate support teams"], | |
| "salary_range": "$75,000 - $120,000" | |
| }, | |
| "Supply Chain Management": { | |
| "category": "Operations", | |
| "domain": "operations", | |
| "required_skills": ["Supply Chain", "Logistics", "Procurement", "Inventory Management", "ERP", "SAP", "Vendor Management", "Forecasting"], | |
| "description": "Optimize supply chain operations including procurement, logistics, and inventory management.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["supply chain", "logistics", "procurement", "inventory", "vendor management", "optimization"], | |
| "responsibilities": ["Supply planning", "Vendor management", "Inventory optimization", "Cost reduction", "Process improvement"], | |
| "salary_range": "$75,000 - $130,000" | |
| }, | |
| # Sales Category | |
| "B2B Sales": { | |
| "category": "Sales", | |
| "domain": "sales", | |
| "required_skills": ["B2B Sales", "CRM", "Salesforce", "Lead Generation", "Negotiation", "Account Management", "Pipeline Management", "Presentation"], | |
| "description": "Drive business-to-business sales through relationship building, lead generation, and strategic account management.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["b2b sales", "enterprise sales", "account management", "lead generation", "crm", "pipeline", "negotiation"], | |
| "responsibilities": ["Lead generation", "Account management", "Sales presentations", "Contract negotiation", "Relationship building"], | |
| "salary_range": "$60,000 - $120,000" | |
| }, | |
| "B2C Sales": { | |
| "category": "Sales", | |
| "domain": "sales", | |
| "required_skills": ["Retail Sales", "Customer Engagement", "Product Knowledge", "POS Systems", "Closing Techniques", "Communication", "Upselling"], | |
| "description": "Sell products and services directly to individual consumers, focusing on customer experience and achieving sales targets.", | |
| "experience_level": "Entry-level", | |
| "keywords": ["b2c", "retail", "consumer sales", "customer service", "sales associate"], | |
| "responsibilities": ["Assist customers", "Process transactions", "Meet sales goals", "Maintain product knowledge"], | |
| "salary_range": "$40,000 - $75,000" | |
| }, | |
| "BFSI Sales": { | |
| "category": "Sales", | |
| "domain": "sales", | |
| "required_skills": ["Financial Products", "Insurance", "Investment Advisory", "Relationship Management", "Regulatory Knowledge", "Wealth Management", "CRM"], | |
| "description": "Specialize in selling banking, financial services, and insurance (BFSI) products to clients.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["bfsi", "banking sales", "insurance", "wealth management", "financial advisor", "relationship manager"], | |
| "responsibilities": ["Sell financial products", "Advise clients on investments", "Build client relationships", "Ensure compliance"], | |
| "salary_range": "$65,000 - $130,000" | |
| }, | |
| "Channel Sales": { | |
| "category": "Sales", | |
| "domain": "sales", | |
| "required_skills": ["Partner Management", "Channel Strategy", "Co-marketing", "Sales Enablement", "Alliance Management", "Business Development", "Negotiation"], | |
| "description": "Develop and manage a network of partners, resellers, and distributors to sell a company's products and services.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["channel sales", "partner management", "alliances", "resellers", "distributors", "business development"], | |
| "responsibilities": ["Recruit and onboard partners", "Develop channel strategy", "Enable partner sales", "Manage partner relationships"], | |
| "salary_range": "$80,000 - $150,000" | |
| }, | |
| "Technology Sales": { | |
| "category": "Sales", | |
| "domain": "sales", | |
| "required_skills": ["Technology Products", "SaaS", "Software Sales", "Technical Knowledge", "Solution Selling", "CRM", "Salesforce", "Presentation"], | |
| "description": "Sell technology products and solutions by understanding customer technical requirements and demonstrating value.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["technology sales", "saas", "software", "solution selling", "technical sales", "enterprise software"], | |
| "responsibilities": ["Technical sales", "Solution design", "Product demos", "ROI analysis", "Customer consultation"], | |
| "salary_range": "$70,000 - $140,000" | |
| }, | |
| # Strategy Category | |
| "Business Consulting": { | |
| "category": "Strategy", | |
| "domain": "consulting", | |
| "required_skills": ["Strategy", "Business Analysis", "Problem Solving", "Presentation", "Excel", "PowerPoint", "Project Management", "Stakeholder Management"], | |
| "description": "Provide strategic business advice and solutions to help organizations improve performance and achieve goals.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["consulting", "strategy", "business analysis", "problem solving", "advisory", "transformation"], | |
| "responsibilities": ["Strategy development", "Business analysis", "Client advisory", "Project management", "Solution implementation"], | |
| "salary_range": "$80,000 - $150,000" | |
| }, | |
| "Business Research": { | |
| "category": "Strategy", | |
| "domain": "strategy", | |
| "required_skills": ["Primary Research", "Secondary Research", "Data Analysis", "Report Writing", "Competitive Intelligence", "Market Sizing", "Qualitative Analysis"], | |
| "description": "Conduct in-depth research and analysis on markets, competitors, and customers to support strategic business decisions.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["business research", "market intelligence", "competitive analysis", "analyst", "insights", "secondary research"], | |
| "responsibilities": ["Gather market data", "Analyze competitive landscape", "Author research reports", "Provide strategic insights"], | |
| "salary_range": "$70,000 - $115,000" | |
| }, | |
| "Corporate Strategy": { | |
| "category": "Strategy", | |
| "domain": "strategy", | |
| "required_skills": ["Strategic Planning", "Business Analysis", "Financial Modeling", "M&A", "Market Analysis", "Competitive Intelligence", "Executive Presentation"], | |
| "description": "Develop and execute corporate strategy including growth initiatives, M&A, and strategic planning.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["corporate strategy", "strategic planning", "m&a", "growth", "competitive analysis", "business development"], | |
| "responsibilities": ["Strategy formulation", "M&A analysis", "Strategic planning", "Competitive analysis", "Executive reporting"], | |
| "salary_range": "$90,000 - $160,000" | |
| }, | |
| # Technology Category | |
| "IT Business Analyst": { | |
| "category": "Technology", | |
| "domain": "technology", | |
| "required_skills": ["Business Analysis", "Requirements Gathering", "Process Mapping", "SQL", "Agile", "JIRA", "Documentation", "Stakeholder Management"], | |
| "description": "Bridge business and technology teams by analyzing requirements and ensuring IT solutions meet business needs.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["business analyst", "requirements", "process analysis", "agile", "documentation", "stakeholder management"], | |
| "responsibilities": ["Requirements analysis", "Process documentation", "Stakeholder coordination", "Solution design", "Testing support"], | |
| "salary_range": "$70,000 - $110,000" | |
| }, | |
| "IT PreSales": { | |
| "category": "Technology", | |
| "domain": "technology", | |
| "required_skills": ["Solution Architecture", "Technical Presentations", "RFP/RFI Response", "Proof of Concept", "Product Demonstration", "Client Engagement", "Requirement Analysis"], | |
| "description": "Provide critical technical expertise during the sales cycle, designing solutions and demonstrating product capabilities to prospective clients.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["presales", "solution architect", "solution consultant", "technical sales", "rfp", "poc"], | |
| "responsibilities": ["Design technical solutions", "Deliver product demos", "Respond to RFPs", "Articulate business value"], | |
| "salary_range": "$95,000 - $160,000" | |
| }, | |
| "IT Project Management": { | |
| "category": "Technology", | |
| "domain": "technology", | |
| "required_skills": ["Agile", "Scrum", "PMP", "Project Planning", "Budget Management", "Risk Management", "Stakeholder Management", "JIRA", "SDLC"], | |
| "description": "Plan, execute, and oversee information technology projects, ensuring they are completed on time, within budget, and to scope.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["it project manager", "pmp", "agile", "scrum", "project delivery", "sdlc", "jira"], | |
| "responsibilities": ["Project planning", "Resource allocation", "Budget tracking", "Stakeholder communication", "Risk mitigation"], | |
| "salary_range": "$85,000 - $145,000" | |
| }, | |
| "Product Management": { | |
| "category": "Technology", | |
| "domain": "product", | |
| "required_skills": ["Product Strategy", "Roadmapping", "User Research", "Analytics", "Agile", "A/B Testing", "Stakeholder Management", "Market Research"], | |
| "description": "Define product strategy, roadmap, and features based on market research and user needs.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["product management", "strategy", "roadmap", "user research", "agile", "features", "analytics"], | |
| "responsibilities": ["Product strategy", "Roadmap planning", "Feature definition", "User research", "Stakeholder management"], | |
| "salary_range": "$90,000 - $160,000" | |
| }, | |
| "Tech Consulting": { | |
| "category": "Technology", | |
| "domain": "consulting", | |
| "required_skills": ["Digital Transformation", "Cloud Strategy", "AWS", "Azure", "System Implementation", "Business Process Re-engineering", "Client Advisory", "Agile"], | |
| "description": "Advise clients on leveraging technology to solve business problems, improve efficiency, and drive innovation.", | |
| "experience_level": "Senior-level", | |
| "keywords": ["technology consulting", "advisory", "digital transformation", "cloud", "aws", "azure", "erp", "implementation"], | |
| "responsibilities": ["Client advisory", "Solution design", "Technology implementation", "Change management", "Strategy development"], | |
| "salary_range": "$90,000 - $170,000" | |
| }, | |
| # Retained Software Engineer as it's a key role in Technology | |
| "Software Engineer": { | |
| "category": "Technology", | |
| "domain": "technology", | |
| "required_skills": ["Python", "JavaScript", "SQL", "Git", "APIs", "Web Development", "React", "Node.js", "Database Design", "Agile"], | |
| "description": "Develop and maintain software applications using modern programming languages and frameworks.", | |
| "experience_level": "Mid-level", | |
| "keywords": ["programming", "software development", "coding", "web development", "full stack", "backend", "frontend"], | |
| "responsibilities": ["Code development", "Software design", "Testing", "Debugging", "Code reviews"], | |
| "salary_range": "$75,000 - $140,000" | |
| }, | |
| } | |
| def _create_skill_database(self): | |
| """Create a comprehensive skill database with categories.""" | |
| return { | |
| "programming": ["Python", "Java", "JavaScript", "C++", "C#", "R", "SQL", "HTML", "CSS", "PHP", "Ruby", "Go", "Rust", "Swift", "Kotlin", "Scala", "MATLAB"], | |
| "data_science": ["Machine Learning", "Statistics", "Data Analysis", "Pandas", "NumPy", "Scikit-learn", "TensorFlow", "PyTorch", "Jupyter", "Data Mining", "Predictive Modeling", "Statistical Analysis"], | |
| "web_development": ["React", "Angular", "Vue.js", "Node.js", "Django", "Flask", "Spring", "Express", "Bootstrap", "jQuery", "REST APIs", "GraphQL"], | |
| "databases": ["MySQL", "PostgreSQL", "MongoDB", "Redis", "Oracle", "SQL Server", "Cassandra", "DynamoDB", "NoSQL", "Database Design"], | |
| "cloud": ["AWS", "Azure", "Google Cloud", "Docker", "Kubernetes", "Terraform", "Jenkins", "CI/CD", "DevOps", "Microservices"], | |
| "analytics": ["Tableau", "Power BI", "Google Analytics", "Excel", "SPSS", "SAS", "Looker", "Qlik", "D3.js", "Data Visualization", "Dashboard Design", "Nielsen/IRI", "KPI"], | |
| "marketing": ["SEO", "SEM", "Google Ads", "Facebook Ads", "Content Marketing", "Email Marketing", "Social Media", "PPC", "Marketing Automation", "Conversion Optimization", "A/B Testing", "Brand Management", "Go-to-Market Strategy", "Category Management"], | |
| "design": ["Figma", "Adobe Creative Suite", "Sketch", "InVision", "Photoshop", "Illustrator", "UI/UX Design", "Prototyping", "Wireframing", "User Research"], | |
| "project_management": ["Agile", "Scrum", "Kanban", "JIRA", "Trello", "Asana", "Project Planning", "Risk Management", "PMP", "Waterfall", "Stakeholder Management", "SDLC", "Budget Management"], | |
| "finance": ["Financial Modeling", "Valuation", "Accounting", "Budgeting", "Forecasting", "Excel", "Bloomberg", "Financial Reporting", "GAAP", "IFRS", "DCF", "LBO", "FP&A", "Variance Analysis", "Accounts Payable", "Accounts Receivable", "Reconciliation", "Internal Controls", "Tax Compliance", "CPA"], | |
| "capital_markets": ["Bloomberg Terminal", "Capital IQ", "Equity Research", "Fixed Income", "Derivatives", "Trading", "Portfolio Management", "Risk Management", "VaR", "Credit Analysis"], | |
| "sales": ["CRM", "Salesforce", "Lead Generation", "Account Management", "Pipeline Management", "Negotiation", "B2B Sales", "B2C Sales", "Channel Sales", "Sales Process", "Solution Selling", "Upselling", "Closing Techniques", "Partner Management"], | |
| "hr": ["Recruitment", "Talent Acquisition", "HRIS", "Employee Relations", "Performance Management", "Benefits Administration", "Training", "Compliance", "ATS", "LinkedIn Recruiter", "Sourcing"], | |
| "operations": ["Supply Chain", "Logistics", "Process Improvement", "Quality Management", "Vendor Management", "Inventory Management", "ERP", "SAP", "Lean Six Sigma", "ITIL", "Service Delivery", "SLA Management", "ServiceNow"], | |
| "consulting": ["Strategy", "Business Analysis", "Problem Solving", "Client Management", "Change Management", "Process Optimization", "Digital Transformation", "Management Consulting", "Client Advisory"], | |
| "technology": ["Software Development", "System Architecture", "Technical Leadership", "Cybersecurity", "Network Administration", "IT Support", "Database Administration", "Solution Architecture", "RFP/RFI Response", "Proof of Concept"], | |
| "research": ["Market Research", "Competitive Analysis", "Survey Design", "Focus Groups", "Statistical Analysis", "Research Methodology", "Data Collection", "Consumer Insights", "Primary Research", "Secondary Research"], | |
| "soft_skills": ["Leadership", "Communication", "Problem Solving", "Team Management", "Critical Thinking", "Negotiation", "Presentation", "Analytical Thinking", "Strategic Thinking", "Relationship Building"] | |
| } | |
| def _extract_skills_from_text(self, text: str) -> List[str]: | |
| """Extract skills from text using keyword matching.""" | |
| text_lower = text.lower() | |
| found_skills = [] | |
| # Check all skill categories | |
| for category, skills in self.skill_database.items(): | |
| for skill in skills: | |
| # Check for exact match or partial match | |
| skill_lower = skill.lower() | |
| if skill_lower in text_lower or any(word in text_lower for word in skill_lower.split()): | |
| if skill not in found_skills: | |
| found_skills.append(skill) | |
| return found_skills | |
| def _calculate_text_similarity(self, text1: str, text2: str) -> float: | |
| """Calculate similarity between two texts using TF-IDF-like approach.""" | |
| # Simple tokenization | |
| def tokenize(text): | |
| return re.findall(r'\b\w+\b', text.lower()) | |
| tokens1 = tokenize(text1) | |
| tokens2 = tokenize(text2) | |
| # Calculate term frequencies | |
| tf1 = Counter(tokens1) | |
| tf2 = Counter(tokens2) | |
| # Get all unique terms | |
| all_terms = set(tokens1 + tokens2) | |
| # Calculate cosine similarity | |
| dot_product = sum(tf1[term] * tf2[term] for term in all_terms) | |
| magnitude1 = math.sqrt(sum(tf1[term]**2 for term in all_terms)) | |
| magnitude2 = math.sqrt(sum(tf2[term]**2 for term in all_terms)) | |
| if magnitude1 == 0 or magnitude2 == 0: | |
| return 0.0 | |
| return dot_product / (magnitude1 * magnitude2) | |
| def _classify_domain(self, text: str) -> Tuple[str, float]: | |
| """Simple domain classification based on keywords.""" | |
| domain_keywords = { | |
| "analytics": ["analytics", "data analysis", "business intelligence", "dashboard", "visualization", "tableau", "power bi", "insights"], | |
| "finance": ["financial", "accounting", "budget", "investment", "revenue", "profit", "banking", "capital markets", "equity", "valuation"], | |
| "technology": ["programming", "software", "development", "coding", "web", "api", "database", "it", "technical", "system"], | |
| "marketing": ["marketing", "seo", "social media", "advertising", "campaign", "brand", "digital marketing", "content"], | |
| "hr": ["human resources", "recruitment", "hiring", "employee", "training", "hr", "talent acquisition", "benefits"], | |
| "sales": ["sales", "revenue", "customer", "client", "negotiation", "crm", "b2b", "b2c", "channel"], | |
| "operations": ["operations", "process", "supply chain", "logistics", "quality", "service", "customer success"], | |
| "consulting": ["consulting", "strategy", "advisory", "business", "transformation", "research"], | |
| "product": ["product", "roadmap", "user", "feature", "requirements", "product management"], | |
| "data_science": ["machine learning", "data science", "predictive modeling", "algorithms", "statistical analysis"] | |
| } | |
| text_lower = text.lower() | |
| domain_scores = {} | |
| for domain, keywords in domain_keywords.items(): | |
| score = sum(1 for keyword in keywords if keyword in text_lower) | |
| if score > 0: | |
| domain_scores[domain] = score / len(keywords) | |
| if domain_scores: | |
| best_domain = max(domain_scores, key=domain_scores.get) | |
| confidence = domain_scores[best_domain] | |
| return best_domain, confidence | |
| return "technology", 0.1 # Default | |
| def enhanced_profile_analysis(self, profile_text: str) -> Tuple[str, str, str]: | |
| """Enhanced profile analysis using standalone algorithms.""" | |
| if not profile_text.strip(): | |
| return "Please enter a profile text.", "", "" | |
| try: | |
| # 1. Basic profile parsing | |
| parsed_profile = self.text_profile_parser.parse(profile_text) | |
| # 2. Extract skills from profile | |
| profile_skills = self._extract_skills_from_text(profile_text) | |
| # 3. Domain classification | |
| domain, domain_conf = self._classify_domain(profile_text) | |
| # 4. Role matching | |
| role_matches = self._find_role_matches(profile_text, profile_skills) | |
| # 5. Get best role prediction | |
| if role_matches: | |
| predicted_role = role_matches[0]["role"] | |
| predicted_category = role_matches[0]["category"] | |
| predicted_domain = role_matches[0]["domain"] | |
| confidence = role_matches[0]["similarity_score"] | |
| else: | |
| predicted_role = "Software Engineer" | |
| predicted_category = "Technology" | |
| predicted_domain = "technology" | |
| confidence = 0.1 | |
| # 6. Skill gap analysis | |
| gap_analysis = self._analyze_skill_gaps(profile_text, profile_skills, predicted_role) | |
| # Prepare results | |
| role_analysis = { | |
| "predicted_role": predicted_role, | |
| "predicted_category": predicted_category, | |
| "predicted_domain": predicted_domain, | |
| "confidence_scores": {"overall": confidence, "domain": domain_conf}, | |
| "top_role_matches": [ | |
| { | |
| "role": match["role"], | |
| "category": match["category"], | |
| "similarity": f"{match['similarity_score']:.2%}", | |
| "confidence": f"{match['confidence']:.2%}", | |
| "matched_skills": match["matched_skills"], | |
| "reasoning": match["reasoning"] | |
| } | |
| for match in role_matches | |
| ], | |
| "domain_analysis": { | |
| "detected_domain": domain, | |
| "confidence": f"{domain_conf:.2%}", | |
| "profile_skills": profile_skills[:15] # Top 15 skills | |
| }, | |
| "profile_sections": { | |
| "education_count": len(parsed_profile.get("education", [])), | |
| "experience_count": len(parsed_profile.get("experience", [])), | |
| "projects_count": len(parsed_profile.get("projects", [])), | |
| "achievements_count": len(parsed_profile.get("achievements", [])), | |
| "certificates_count": len(parsed_profile.get("certificates", [])) | |
| }, | |
| "system_status": { | |
| "mode": "Google Colab Standalone Mode", | |
| "dependencies": "Zero external dependencies" | |
| } | |
| } | |
| # Career recommendations HTML | |
| career_recommendations = self._generate_career_recommendations_html( | |
| predicted_role, predicted_category, predicted_domain, role_matches, gap_analysis | |
| ) | |
| return ( | |
| json.dumps(role_analysis, indent=2), | |
| json.dumps(gap_analysis, indent=2), | |
| career_recommendations | |
| ) | |
| except Exception as e: | |
| error_msg = f"Error in profile analysis: {str(e)}" | |
| return error_msg, "", "" | |
| def _find_role_matches(self, profile_text: str, profile_skills: List[str]) -> List[Dict]: | |
| """Find role matches using multiple scoring methods.""" | |
| matches = [] | |
| for role, data in self.role_database.items(): | |
| # 1. Skill-based scoring | |
| matched_skills = [] | |
| for skill in data["required_skills"]: | |
| if skill in profile_skills: | |
| matched_skills.append(skill) | |
| skill_score = len(matched_skills) / len(data["required_skills"]) if data["required_skills"] else 0 | |
| # 2. Keyword-based scoring | |
| keyword_score = 0 | |
| for keyword in data["keywords"]: | |
| if keyword.lower() in profile_text.lower(): | |
| keyword_score += 1 | |
| keyword_score = keyword_score / len(data["keywords"]) if data["keywords"] else 0 | |
| # 3. Text similarity scoring | |
| role_text = f"{data['description']} {' '.join(data['required_skills'])} {' '.join(data['keywords'])}" | |
| text_similarity = self._calculate_text_similarity(profile_text, role_text) | |
| # 4. Combined scoring | |
| combined_score = (skill_score * 0.4) + (keyword_score * 0.3) + (text_similarity * 0.3) | |
| # 5. Confidence calculation | |
| confidence = min(combined_score + (len(matched_skills) * 0.05), 1.0) | |
| # 6. Reasoning | |
| reasoning = f"Skills: {len(matched_skills)}/{len(data['required_skills'])}, Keywords: {int(keyword_score * len(data['keywords']))}/{len(data['keywords'])}, Text similarity: {text_similarity:.2%}" | |
| matches.append({ | |
| "role": role, | |
| "category": data["category"], | |
| "domain": data["domain"], | |
| "similarity_score": combined_score, | |
| "confidence": confidence, | |
| "matched_skills": matched_skills, | |
| "reasoning": reasoning, | |
| "salary_range": data.get("salary_range", "Not specified") | |
| }) | |
| # Sort by combined score | |
| matches.sort(key=lambda x: x["similarity_score"], reverse=True) | |
| return matches | |
| def _analyze_skill_gaps(self, profile_text: str, profile_skills: List[str], target_role: str) -> Dict: | |
| """Analyze skill gaps for the target role.""" | |
| if target_role not in self.role_database: | |
| return {"error": f"Role '{target_role}' not found"} | |
| role_data = self.role_database[target_role] | |
| required_skills = set(role_data["required_skills"]) | |
| current_skills = set(profile_skills) | |
| matching_skills = list(required_skills & current_skills) | |
| missing_skills = list(required_skills - current_skills) | |
| # Generate recommendations | |
| recommendations = [] | |
| skill_learning_map = { | |
| "python": "Complete Python programming courses on Coursera or edX", | |
| "sql": "Practice SQL queries on HackerRank or LeetCode", | |
| "tableau": "Get Tableau certification through official Tableau training", | |
| "power bi": "Complete Microsoft Power BI certification path", | |
| "machine learning": "Take Andrew Ng's Machine Learning course on Coursera", | |
| "aws": "Pursue AWS certification starting with Cloud Practitioner", | |
| "javascript": "Complete JavaScript fundamentals on freeCodeCamp", | |
| "react": "Build projects using React through official React tutorial", | |
| "excel": "Complete advanced Excel courses focusing on data analysis", | |
| "agile": "Consider Scrum Master or Product Owner certification", | |
| "google analytics": "Complete Google Analytics certification", | |
| "seo": "Take SEO courses on Moz Academy or SEMrush", | |
| "financial modeling": "Complete financial modeling courses on Wall Street Prep", | |
| "bloomberg terminal": "Get Bloomberg Market Concepts (BMC) certification", | |
| "salesforce": "Pursue Salesforce Administrator certification", | |
| "crm": "Learn CRM best practices through HubSpot Academy" | |
| } | |
| for skill in missing_skills[:8]: # Top 8 missing skills | |
| skill_lower = skill.lower() | |
| recommendation = skill_learning_map.get(skill_lower, f"Seek online courses or tutorials for {skill}") | |
| # Determine priority | |
| if skill_lower in ["python", "sql", "excel", "javascript"]: | |
| priority = "High" | |
| elif skill_lower in ["tableau", "power bi", "aws", "react"]: | |
| priority = "Medium" | |
| else: | |
| priority = "Low" | |
| recommendations.append({ | |
| "skill": skill, | |
| "recommendation": recommendation, | |
| "priority": priority, | |
| "estimated_time": "2-4 weeks" if priority == "High" else "1-2 weeks" | |
| }) | |
| # Calculate match percentage | |
| match_percentage = len(matching_skills) / len(required_skills) if required_skills else 0 | |
| return { | |
| "target_role": target_role, | |
| "current_match": f"{match_percentage:.1%}", | |
| "matching_skills": matching_skills, | |
| "skill_gaps": missing_skills, | |
| "recommendations": recommendations, | |
| "role_info": { | |
| "description": role_data["description"], | |
| "experience_level": role_data["experience_level"], | |
| "salary_range": role_data.get("salary_range", "Not specified"), | |
| "key_responsibilities": role_data.get("responsibilities", []) | |
| } | |
| } | |
| def _generate_career_recommendations_html(self, predicted_role: str, predicted_category: str, | |
| predicted_domain: str, role_matches: List[Dict], | |
| gap_analysis: Dict) -> str: | |
| """Generate comprehensive HTML for career recommendations.""" | |
| best_match = role_matches[0] if role_matches else None | |
| html = f""" | |
| <div style="font-family: Arial, sans-serif; max-width: 900px; color: white;"> | |
| <h2 style="color: white; border-bottom: 2px solid #D1C4E9; padding-bottom: 10px;"> | |
| π― Career Recommendations & Analysis | |
| </h2> | |
| <div style="background: #7E57C2; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;"> | |
| π Best Role Match: {predicted_role} | |
| </h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; color: #F3E5F5;"> | |
| <div> | |
| <p><strong>Category:</strong> {predicted_category}</p> | |
| <p><strong>Domain:</strong> {predicted_domain}</p> | |
| </div> | |
| <div> | |
| <p><strong>Match Score:</strong> {best_match['similarity_score']:.1%}</p> | |
| <p><strong>Salary Range:</strong> {best_match.get('salary_range', 'Not specified')}</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div style="background: #5E35B1; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">π Top Alternative Roles</h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px;"> | |
| """ | |
| for i, match in enumerate(role_matches[1:5], 1): # Top 4 alternatives | |
| html += f""" | |
| <div style="background: #7E57C2; color: white; padding: 10px; border-radius: 5px; border-left: 3px solid #D1C4E9;"> | |
| <strong>{match['role']}</strong><br> | |
| <small style="color: #F3E5F5;">Category: {match['category']} | Score: {match['similarity_score']:.1%}</small> | |
| </div> | |
| """ | |
| html += """ | |
| </div> | |
| </div> | |
| """ | |
| # Skill recommendations | |
| if gap_analysis.get("recommendations"): | |
| html += """ | |
| <div style="background: #5E35B1; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">π Skill Development Roadmap</h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;"> | |
| """ | |
| high_priority = [rec for rec in gap_analysis["recommendations"] if rec["priority"] == "High"] | |
| medium_priority = [rec for rec in gap_analysis["recommendations"] if rec["priority"] == "Medium"] | |
| html += """ | |
| <div> | |
| <h4 style="color: white; margin-top: 0;">π₯ High Priority Skills</h4> | |
| """ | |
| for rec in high_priority[:3]: | |
| html += f""" | |
| <div style="margin: 10px 0; padding: 10px; background: #7E57C2; color: white; border-radius: 5px; border-left: 3px solid #D1C4E9;"> | |
| <strong>{rec['skill']}</strong> | |
| <br><small style="color: #F3E5F5;">β±οΈ {rec.get('estimated_time', '2-4 weeks')}</small> | |
| <br><small style="color: #F3E5F5;">π‘ {rec['recommendation']}</small> | |
| </div> | |
| """ | |
| html += """ | |
| </div> | |
| <div> | |
| <h4 style="color: white; margin-top: 0;">β Medium Priority Skills</h4> | |
| """ | |
| for rec in medium_priority[:3]: | |
| html += f""" | |
| <div style="margin: 10px 0; padding: 10px; background: #7E57C2; color: white; border-radius: 5px; border-left: 3px solid #D1C4E9;"> | |
| <strong>{rec['skill']}</strong> | |
| <br><small style="color: #F3E5F5;">β±οΈ {rec.get('estimated_time', '1-2 weeks')}</small> | |
| <br><small style="color: #F3E5F5;">π‘ {rec['recommendation']}</small> | |
| </div> | |
| """ | |
| html += """ | |
| </div> | |
| </div> | |
| </div> | |
| """ | |
| # Career path suggestions | |
| html += f""" | |
| <div style="background: #512DA8; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">π Career Development Path</h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px;"> | |
| <div style="background: #673AB7; color: white; padding: 15px; border-radius: 8px;"> | |
| <h4 style="color: white; margin-top: 0;">π Immediate (1-3 months)</h4> | |
| <ul style="margin: 0; padding-left: 20px; font-size: 14px; color: #F3E5F5;"> | |
| <li>Focus on high-priority skills</li> | |
| <li>Complete online certifications</li> | |
| <li>Build portfolio projects</li> | |
| <li>Network in {predicted_domain} domain</li> | |
| </ul> | |
| </div> | |
| <div style="background: #673AB7; color: white; padding: 15px; border-radius: 8px;"> | |
| <h4 style="color: white; margin-top: 0;">π― Short-term (3-12 months)</h4> | |
| <ul style="margin: 0; padding-left: 20px; font-size: 14px; color: #F3E5F5;"> | |
| <li>Apply for {predicted_role} positions</li> | |
| <li>Gain hands-on experience</li> | |
| <li>Develop medium-priority skills</li> | |
| <li>Seek mentorship opportunities</li> | |
| </ul> | |
| </div> | |
| <div style="background: #673AB7; color: white; padding: 15px; border-radius: 8px;"> | |
| <h4 style="color: white; margin-top: 0;">π Long-term (1-2 years)</h4> | |
| <ul style="margin: 0; padding-left: 20px; font-size: 14px; color: #F3E5F5;"> | |
| <li>Target senior roles in {predicted_category}</li> | |
| <li>Develop leadership skills</li> | |
| <li>Consider specialization</li> | |
| <li>Explore management tracks</li> | |
| </ul> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| """ | |
| return html | |
| def compare_profile_with_jd(self, profile_text: str, job_description: str) -> str: | |
| """Compare a profile with a job description and provide detailed analysis.""" | |
| if not profile_text.strip() or not job_description.strip(): | |
| return "Please provide both profile and job description for comparison." | |
| try: | |
| # Analyze the profile | |
| profile_analysis = self.enhanced_profile_analysis(profile_text) | |
| role_analysis = json.loads(profile_analysis[0]) | |
| # Extract skills from profile and JD | |
| profile_skills = set(role_analysis["domain_analysis"]["profile_skills"]) | |
| jd_skills = self._extract_skills_from_text(job_description) | |
| jd_skills_set = set(jd_skills) | |
| # Calculate text similarity between profile and JD | |
| text_similarity = self._calculate_text_similarity(profile_text, job_description) | |
| # Find matching and missing skills | |
| matching_skills = list(profile_skills & jd_skills_set) | |
| missing_skills = list(jd_skills_set - profile_skills) | |
| extra_skills = list(profile_skills - jd_skills_set) | |
| # Calculate overall match score | |
| skill_match_score = len(matching_skills) / len(jd_skills_set) if jd_skills_set else 0 | |
| overall_score = (skill_match_score * 0.6) + (text_similarity * 0.4) | |
| # Determine match level | |
| if overall_score >= 0.8: | |
| match_level = "Excellent Match" | |
| elif overall_score >= 0.6: | |
| match_level = "Good Match" | |
| elif overall_score >= 0.4: | |
| match_level = "Fair Match" | |
| else: | |
| match_level = "Poor Match" | |
| # Extract key requirements from JD | |
| jd_domain, jd_domain_conf = self._classify_domain(job_description) | |
| comparison = { | |
| "overall_match_score": f"{overall_score:.1%}", | |
| "match_level": match_level, | |
| "profile_analysis": { | |
| "predicted_role": role_analysis["predicted_role"], | |
| "category": role_analysis["predicted_category"], | |
| "domain": role_analysis["predicted_domain"], | |
| "confidence": role_analysis["confidence_scores"]["overall"], | |
| "total_skills": len(profile_skills) | |
| }, | |
| "job_description_analysis": { | |
| "detected_domain": jd_domain, | |
| "domain_confidence": f"{jd_domain_conf:.1%}", | |
| "required_skills": jd_skills, | |
| "total_required_skills": len(jd_skills_set) | |
| }, | |
| "skill_analysis": { | |
| "matching_skills": matching_skills, | |
| "matching_skills_count": len(matching_skills), | |
| "missing_skills": missing_skills[:10], # Top 10 missing skills | |
| "missing_skills_count": len(missing_skills), | |
| "extra_skills": extra_skills[:5], # Top 5 extra skills | |
| "skill_match_percentage": f"{skill_match_score:.1%}" | |
| }, | |
| "compatibility_scores": { | |
| "skill_compatibility": f"{skill_match_score:.1%}", | |
| "text_similarity": f"{text_similarity:.1%}", | |
| "overall_score": f"{overall_score:.1%}" | |
| }, | |
| "recommendations": { | |
| "should_apply": overall_score >= 0.5, | |
| "key_improvements": missing_skills[:5], | |
| "strengths": matching_skills[:5], | |
| "interview_readiness": "High" if overall_score >= 0.7 else "Medium" if overall_score >= 0.5 else "Low" | |
| } | |
| } | |
| return json.dumps(comparison, indent=2) | |
| except Exception as e: | |
| return f"Error in profile vs JD comparison: {str(e)}" | |
| def compare_profile_with_jd_detailed(self, profile_text: str, job_description: str) -> tuple: | |
| """Compare profile with JD and return both JSON and detailed HTML analysis.""" | |
| if not profile_text.strip() or not job_description.strip(): | |
| return "Please provide both profile and job description for comparison.", "" | |
| try: | |
| # Get the basic comparison | |
| comparison_json = self.compare_profile_with_jd(profile_text, job_description) | |
| comparison_data = json.loads(comparison_json) | |
| # Generate detailed HTML analysis | |
| detailed_html = self._generate_jd_comparison_html(comparison_data) | |
| return comparison_json, detailed_html | |
| except Exception as e: | |
| error_msg = f"Error in detailed profile vs JD comparison: {str(e)}" | |
| return error_msg, "" | |
| def _generate_jd_comparison_html(self, comparison_data: dict) -> str: | |
| """Generate detailed HTML for profile vs JD comparison.""" | |
| overall_score = float(comparison_data["overall_match_score"].replace('%', '')) / 100 | |
| match_level = comparison_data["match_level"] | |
| # Determine color based on match level - NEW PURPLE THEME | |
| if overall_score >= 0.8: | |
| score_color = "#673AB7" # Bright Purple for Excellent | |
| elif overall_score >= 0.6: | |
| score_color = "#7E57C2" # Medium Purple for Good | |
| elif overall_score >= 0.4: | |
| score_color = "#9575CD" # Lighter Purple for Fair | |
| else: | |
| score_color = "#5E35B1" # Darker Purple for Poor | |
| html = f""" | |
| <div style="font-family: Arial, sans-serif; max-width: 900px; color: white;"> | |
| <h2 style="color: white; border-bottom: 2px solid #D1C4E9; padding-bottom: 10px;"> | |
| π Profile vs Job Description Analysis | |
| </h2> | |
| <div style="background: {score_color}; padding: 20px; border-radius: 10px; margin: 20px 0; text-align: center;"> | |
| <h3 style="margin: 0; font-size: 24px; color: white;"> | |
| {match_level}: {comparison_data['overall_match_score']} | |
| </h3> | |
| <p style="margin: 10px 0 0 0; font-size: 16px; color: #F3E5F5;"> | |
| Interview Readiness: {comparison_data['recommendations']['interview_readiness']} | |
| </p> | |
| </div> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0;"> | |
| <div style="background: #5E35B1; padding: 20px; border-radius: 10px;"> | |
| <h3 style="color: white; margin-top: 0;">π€ Profile Analysis</h3> | |
| <p><strong>Predicted Role:</strong> {comparison_data['profile_analysis']['predicted_role']}</p> | |
| <p><strong>Category:</strong> {comparison_data['profile_analysis']['category']}</p> | |
| <p><strong>Domain:</strong> {comparison_data['profile_analysis']['domain']}</p> | |
| <p><strong>Total Skills:</strong> {comparison_data['profile_analysis']['total_skills']}</p> | |
| </div> | |
| <div style="background: #5E35B1; padding: 20px; border-radius: 10px;"> | |
| <h3 style="color: white; margin-top: 0;">π Job Requirements</h3> | |
| <p><strong>Detected Domain:</strong> {comparison_data['job_description_analysis']['detected_domain']}</p> | |
| <p><strong>Domain Confidence:</strong> {comparison_data['job_description_analysis']['domain_confidence']}</p> | |
| <p><strong>Required Skills:</strong> {comparison_data['job_description_analysis']['total_required_skills']}</p> | |
| </div> | |
| </div> | |
| <div style="background: #673AB7; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">β Matching Skills ({comparison_data['skill_analysis']['matching_skills_count']} skills)</h3> | |
| <div style="display: flex; flex-wrap: wrap; gap: 8px;"> | |
| """ | |
| for skill in comparison_data['skill_analysis']['matching_skills']: | |
| html += f'<span style="background: #512DA8; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px;">{skill}</span>' | |
| html += """ | |
| </div> | |
| </div> | |
| """ | |
| if comparison_data['skill_analysis']['missing_skills']: | |
| html += f""" | |
| <div style="background: #7E57C2; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">β Missing Skills ({comparison_data['skill_analysis']['missing_skills_count']} skills)</h3> | |
| <div style="display: flex; flex-wrap: wrap; gap: 8px;"> | |
| """ | |
| for skill in comparison_data['skill_analysis']['missing_skills']: | |
| html += f'<span style="background: #9575CD; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px;">{skill}</span>' | |
| html += """ | |
| </div> | |
| </div> | |
| """ | |
| html += f""" | |
| <div style="background: #512DA8; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">π Compatibility Scores</h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; text-align: center;"> | |
| <div> | |
| <h4 style="margin: 0;">Skill Match</h4> | |
| <p style="font-size: 18px; font-weight: bold; margin: 5px 0;">{comparison_data['compatibility_scores']['skill_compatibility']}</p> | |
| </div> | |
| <div> | |
| <h4 style="margin: 0;">Text Similarity</h4> | |
| <p style="font-size: 18px; font-weight: bold; margin: 5px 0;">{comparison_data['compatibility_scores']['text_similarity']}</p> | |
| </div> | |
| <div> | |
| <h4 style="margin: 0;">Overall Score</h4> | |
| <p style="font-size: 18px; font-weight: bold; margin: 5px 0;">{comparison_data['compatibility_scores']['overall_score']}</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div style="background: #4527A0; padding: 20px; border-radius: 10px; margin: 20px 0;"> | |
| <h3 style="color: white; margin-top: 0;">π‘ Recommendations</h3> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; color: #F3E5F5;"> | |
| <div> | |
| <h4>Should Apply?</h4> | |
| <p style="font-weight: bold; color: white;"> | |
| {"β Yes, good fit!" if comparison_data['recommendations']['should_apply'] else "β Consider improving skills first"} | |
| </p> | |
| <h4>Key Strengths:</h4> | |
| <ul> | |
| """ | |
| for strength in comparison_data['recommendations']['strengths']: | |
| html += f"<li>{strength}</li>" | |
| html += f""" | |
| </ul> | |
| </div> | |
| <div> | |
| <h4>Priority Improvements:</h4> | |
| <ul> | |
| """ | |
| for improvement in comparison_data['recommendations']['key_improvements']: | |
| html += f"<li>{improvement}</li>" | |
| html += """ | |
| </ul> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| """ | |
| return html | |
| def create_colab_interface(): | |
| """Create Gradio interface optimized for Google Colab.""" | |
| app = StandaloneResumeMatcherApp() | |
| with gr.Blocks(title="Resume Matcher", theme=gr.themes.Soft()) as interface: | |
| gr.Markdown("# π Resume Matcher - Standalone Snappy Edition") | |
| gr.Markdown(""" | |
| **β Zero Dependencies | β‘ Instant Results | π― Advanced AI Analytics** | |
| **Perfect for Quick Scans - Just paste and run!** | |
| **Key Features:** | |
| - π― **Smart Role Matching**: AI-powered role classification | |
| - π **Skill Gap Analysis**: Identifies missing skills with learning roadmaps | |
| - π **Profile vs Job Matching**: Detailed compatibility scoring | |
| - π° **Salary Insights**: Market salary ranges for different roles | |
| - π **Learning Recommendations**: Personalized skill development plans | |
| - π **Career Roadmaps**: Short-term and long-term career guidance | |
| """) | |
| with gr.Tabs(): | |
| # Tab 1: Profile Analysis | |
| with gr.TabItem("π― Profile Analysis"): | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| gr.Markdown("## π Candidate Profile Input") | |
| profile_input = gr.Textbox( | |
| label="Paste Candidate Profile", | |
| placeholder="""Example format: | |
| Education: | |
| Master's in Computer Science - Stanford University - 3.8 GPA | |
| Experience: | |
| Google - Software Engineer - 2020-2023 - Developed web applications using React and Python | |
| Microsoft - Intern - 2019 - Built machine learning models for data analysis | |
| Skills: | |
| Python, JavaScript, React, SQL, Machine Learning, AWS, Git, Agile, Problem Solving | |
| Projects: | |
| E-commerce Platform - Built full-stack web application with React frontend and Django backend | |
| Data Analysis Tool - Created Python-based tool for analyzing customer behavior data | |
| Achievements: | |
| AWS Certified Developer, Published research paper on ML algorithms, Led team of 5 developers""", | |
| lines=20, | |
| max_lines=30 | |
| ) | |
| analyze_btn = gr.Button("π Analyze Profile", variant="primary", size="lg") | |
| with gr.Column(scale=1): | |
| gr.Markdown("## π Analysis Results") | |
| with gr.Tabs(): | |
| with gr.TabItem("π― Role Classification"): | |
| role_analysis_output = gr.JSON(label="Detailed Role Analysis") | |
| with gr.TabItem("π Skill Gap Analysis"): | |
| skill_gap_output = gr.JSON(label="Skill Gap & Recommendations") | |
| with gr.TabItem("π Career Roadmap"): | |
| career_recommendations_output = gr.HTML(label="Career Development Plan") | |
| analyze_btn.click( | |
| fn=app.enhanced_profile_analysis, | |
| inputs=[profile_input], | |
| outputs=[role_analysis_output, skill_gap_output, career_recommendations_output] | |
| ) | |
| # Tab 2: Profile vs Job Description | |
| with gr.TabItem("π Profile vs Job Description"): | |
| gr.Markdown("## π― Compare Profile Against Job Description") | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("### π€ Candidate Profile") | |
| profile_jd_input = gr.Textbox( | |
| label="Candidate Profile", | |
| lines=12, | |
| placeholder="Paste candidate profile here..." | |
| ) | |
| with gr.Column(): | |
| gr.Markdown("### π Job Description") | |
| jd_input = gr.Textbox( | |
| label="Job Description", | |
| lines=12, | |
| placeholder="""Paste job description here... | |
| Example: | |
| We are looking for a Software Engineer to join our team. | |
| Requirements: | |
| - 3+ years of experience in Python or Java | |
| - Experience with web frameworks (Django, Flask, Spring) | |
| - Knowledge of databases (SQL, NoSQL) | |
| - Experience with cloud platforms (AWS, GCP, Azure) | |
| - Strong problem-solving skills | |
| - Bachelor's degree in Computer Science or related field | |
| Responsibilities: | |
| - Develop and maintain web applications | |
| - Collaborate with cross-functional teams | |
| - Write clean, maintainable code | |
| - Participate in code reviews | |
| - Debug and resolve technical issues""" | |
| ) | |
| compare_jd_btn = gr.Button("π Analyze Match Score", variant="primary", size="lg") | |
| with gr.Tabs(): | |
| with gr.TabItem("π Match Score & Analysis"): | |
| jd_comparison_output = gr.JSON(label="Profile vs JD Analysis") | |
| with gr.TabItem("π Detailed Breakdown"): | |
| jd_detailed_output = gr.HTML(label="Detailed Match Analysis") | |
| compare_jd_btn.click( | |
| fn=app.compare_profile_with_jd_detailed, | |
| inputs=[profile_jd_input, jd_input], | |
| outputs=[jd_comparison_output, jd_detailed_output] | |
| ) | |
| with gr.Accordion("βΉοΈ How to Use & Features", open=False): | |
| gr.Markdown(""" | |
| ### π Quick Start Guide: | |
| 1. **Profile Analysis**: Paste a candidate's resume/profile in the first tab to get: | |
| - AI-powered role predictions with confidence scores | |
| - Skill gap analysis with priority levels | |
| - Personalized learning recommendations | |
| - Career development roadmap | |
| 2. **Profile vs Job Matching**: Compare a profile against a job description to get: | |
| - Overall compatibility score | |
| - Detailed skill matching analysis | |
| - Interview readiness assessment | |
| - Specific improvement recommendations | |
| ### π― What Makes This Special: | |
| - **Zero Setup**: No installations, dependencies, or API keys needed | |
| - **Instant Results**: Fast processing with immediate feedback | |
| - **Comprehensive Analysis**: Expanded role library across multiple categories | |
| - **Smart Algorithms**: Multi-factor scoring (skills + keywords + text similarity) | |
| - **Actionable Insights**: Specific learning paths and career guidance | |
| """) | |
| return interface | |
| # Main execution | |
| if __name__ == "__main__": | |
| print("π Starting Resume Matcher...") | |
| print("β No external dependencies required!") | |
| print("π Loading comprehensive role database...") | |
| interface = create_colab_interface() | |
| print("π― Ready to analyze resumes and match profiles!") | |
| print("π‘ Features: Role Classification | Skill Gap Analysis | Job Matching | Career Recommendations") | |
| # Launch with Colab-optimized settings | |
| interface.launch( | |
| share=True, # Creates public link for sharing | |
| debug=True, # Shows detailed error messages | |
| show_error=True, # Display errors in interface | |
| quiet=False # Show startup logs | |
| ) |