Spaces:
Runtime error
Runtime error
| """ | |
| lib/company_tier.py — PRINCIPAL-LEVEL UPGRADE | |
| Company quality is the SINGLE BIGGEST missing signal in the original system. | |
| The JD explicitly and repeatedly emphasizes "product companies (not pure services)" | |
| and this signal was completely absent from scoring. | |
| This module provides a tiered company quality score based on: | |
| 1. Known global tech titans (FAANG+) | |
| 2. Major product companies (Indian & global) | |
| 3. AI/ML-native product companies | |
| 4. Known services/consulting firms (negative signal) | |
| 5. Unknown companies (neutral) | |
| Design rationale: | |
| - The JD says "If your career has been entirely at consulting firms... we won't move forward" | |
| - But the disqualifier_penalty only fires when ALL roles are at consulting firms | |
| - A candidate currently at Genpact AI with one prior startup role escapes the penalty | |
| - Company quality as a continuous signal captures this gradient | |
| - Also differentiates Apple/Meta (Tier 1) from a random startup (Tier 3) | |
| """ | |
| from __future__ import annotations | |
| # Tier 1: Global tech titans — the JD's "Google or Meta" benchmark | |
| GLOBAL_TECH_TIER1 = [ | |
| "google", "alphabet", "deepmind", | |
| "meta", "facebook", | |
| "microsoft", | |
| "apple", | |
| "amazon", | |
| "netflix", | |
| "nvidia", | |
| "openai", "anthropic", | |
| "uber", "airbnb", | |
| "spotify", "linkedin", | |
| "bloomberg", | |
| "palantir", "databricks", "snowflake", "confluent", | |
| ] | |
| # Tier 2: Major Indian & global product companies | |
| # These are companies the JD would recognize as "product companies" | |
| PRODUCT_TIER2 = [ | |
| "flipkart", "razorpay", "zomato", "swiggy", "ola", | |
| "phonepe", "cred", "paytm", "nykaa", "dream11", | |
| "meesho", "cult.fit", "cure.fit", | |
| "inmobi", "myntra", "bigbasket", | |
| "twitter", "stripe", "grab", "foodpanda", | |
| "booking.com", "adobe", "salesforce", "service now", "servicenow", | |
| "atlassian", "shopify", "dropbox", "slack", | |
| "samsung", "intel", "ibm research", | |
| "baidu", "alibaba", "tencent", "bytedance", | |
| "stripe", | |
| ] | |
| # Tier 3: AI/ML-native product companies (smaller but genuine product) | |
| AI_ML_PRODUCT_TIER3 = [ | |
| "sarvam ai", "sarvam", | |
| "niramai", "niramai health", | |
| "rephrase.ai", "rephrase", | |
| "haptik", "haptik ai", | |
| "krutrim", "krutrim ai", | |
| "mad street den", | |
| "locobuzz", | |
| "verloop", "verloop.io", | |
| "obvious.ai", "obvious", | |
| "fluid ai", | |
| "basis.ai", | |
| "threado", | |
| "electric ai", "electric", | |
| "kore.ai", "kore", | |
| "aible", "h2o.ai", "datarobot", | |
| "weights & biases", "wandb", | |
| "weaviate", "pinecone", "qdrant", | |
| "anyscale", "modal", | |
| "langchain", "llamaindex", | |
| "cohere", "ai21 labs", | |
| "stability ai", "midjourney", | |
| "scale ai", "labelbox", | |
| "snorkel", "cleanlab", | |
| "yellow.ai", "yellow messenger", | |
| "wysa", "wysa ai", | |
| "saarthi.ai", "saarthi", | |
| "agilet", "agilyx", | |
| "nios", "nios lab", | |
| ] | |
| # Tier 4: Services companies disguised as AI (lower than neutral) | |
| SERVICES_DISGUISED = [ | |
| "genpact", "genpact ai", "genpact digital", | |
| "tcs", "tata consultancy", "infosys", "wipro", | |
| "accenture", "cognizant", "capgemini", | |
| "hcl", "tech mahindra", "mindtree", "lti", | |
| "mphasis", "hexaware", "zensar", "birlasoft", | |
| "niit", "cyient", "mastek", "sonata software", | |
| "persistent systems", "persistent", | |
| "wns", "firstsource", "genpact", | |
| ] | |
| # Edtech / non-AI product (neutral to slightly positive) | |
| EDTECH_COMPANIES = [ | |
| "vedantu", "byju", "unacademy", "upgrad", | |
| "physics wallah", "pw", "eros now", | |
| ] | |
| # HR-tech / marketplace (JD nice-to-have) | |
| HR_MARKETPLACE = [ | |
| "redrob", "naukri", "linkedin", "indeed", | |
| "glassdoor", "hire" "zee", "foundit", | |
| ] | |
| def company_quality_score(company: str) -> float: | |
| """ | |
| Returns a company quality score in [0.20, 1.00]. | |
| Scoring: | |
| 1.00 -- Global tech titans (FAANG+) | |
| 0.90 -- Major product companies (Flipkart, Razorpay, etc.) | |
| 0.80 -- AI/ML-native product companies | |
| 0.65 -- Edtech / marketplace companies (JD nice-to-have domain) | |
| 0.50 -- Unknown company (neutral default) | |
| 0.30 -- Known services/consulting (even if branded as "AI") | |
| """ | |
| if not company: | |
| return 0.50 | |
| c = company.lower().strip() | |
| # Check in reverse tier order (most specific first) | |
| for name in SERVICES_DISGUISED: | |
| if name in c: | |
| return 0.30 | |
| for name in GLOBAL_TECH_TIER1: | |
| if name in c: | |
| return 1.00 | |
| for name in PRODUCT_TIER2: | |
| if name in c: | |
| return 0.90 | |
| for name in HR_MARKETPLACE: | |
| if name in c: | |
| return 0.70 | |
| for name in AI_ML_PRODUCT_TIER3: | |
| if name in c: | |
| return 0.80 | |
| for name in EDTECH_COMPANIES: | |
| if name in c: | |
| return 0.55 | |
| return 0.50 # Unknown — neutral | |
| def company_tier_label(company: str) -> str: | |
| """Return human-readable tier label for reasoning.""" | |
| score = company_quality_score(company) | |
| if score >= 0.95: | |
| return "global tech titan" | |
| if score >= 0.85: | |
| return "major product company" | |
| if score >= 0.75: | |
| return "AI/ML product company" | |
| if score >= 0.60: | |
| return "domain-relevant product company" | |
| if score <= 0.35: | |
| return "services/consulting firm" | |
| return "company" |