Spaces:
Paused
Paused
File size: 23,516 Bytes
84e6fab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | """
school_classifier.py — InternScrapper school tagging module.
Classifies a job by title + company name into university school programs.
Uses word-boundary-aware regex so "java" never matches "javascript".
Each job receives at least one program tag; if nothing clears the threshold
the single top-scoring program is used as a fallback.
"""
import re
# ── School registry ──────────────────────────────────────────────────────────
SCHOOLS: dict[str, dict] = {
"SOLAS": {
"name": "School of Liberal Arts and Sciences",
"programs": [
"B.Sc. Psychology",
"B.Sc. Environmental Science",
"B.A. Philosophy",
"B.A. Politics and International Relations",
],
},
"SOB": {
"name": "School of Business",
"programs": [
"BBA Digital Marketing",
"BBA Capital Markets",
"BBA Business Intelligence and Data Analytics",
"BBA Finance",
"BBA Human Resources",
"BBA Marketing",
"BBA Business (General)",
"B.Com. Accounting and Commerce",
"B.Com. ACCA International Accounting",
"MBA Data and AI",
"MBA Finance",
"MBA Management",
],
},
"SODI": {
"name": "School of Design and Innovation",
"programs": [
"B.Des. Interior Environments",
"B.Des. Product and Industrial Design",
"B.Des. Transdisciplinary Design",
"B.Des. User Experience",
"B.Des. Communication and New Media",
],
},
"SoEPP": {
"name": "School of Economics and Public Policy",
"programs": [
"B.Sc. Economics with Data Analytics",
"B.Sc. Economics with Development Studies",
"M.A. Public Policy and e-Governance",
],
},
"SOCSE": {
"name": "School of Computer Science and Engineering",
"programs": [
"B.Tech. / B.Sc. Computer Science and Engineering",
"B.Sc. Data Science",
"BCA Computer Applications",
"B.Des. User Experience",
"B.Des. Communication and New Media",
],
},
"SOFMCA": {
"name": "School of Film, Media and Creative Arts",
"programs": [
"B.Sc. Filmmaking",
"B.Sc. Animation, VFX and Gaming",
"B.A. Media and Journalism",
"B.A. Acting",
],
},
"SOLaw": {
"name": "School of Law",
"programs": [
"LL.B. Law",
"B.Sc. Criminology, Cyber Law and Forensic Sciences",
],
},
"SOAHP": {
"name": "School of Allied and Healthcare Professions",
"programs": [
"B.Sc. Cardiac Care Technology",
"B.Sc. Anaesthesia and OT Technology",
"B.Sc. Medical Laboratory Technology",
],
},
}
# ── Keyword lists ─────────────────────────────────────────────────────────────
# Keys must exactly match the program names in SCHOOLS["programs"].
# Values are lowercase-friendly; classify_job() lowercases both text and keywords.
# Matching uses word boundaries so partial substrings don't fire.
PROGRAM_KEYWORDS: dict[str, list[str]] = {
# ══ SOLAS — School of Liberal Arts and Sciences ══════════════════════════
"B.Sc. Psychology": [
"psychology", "psychologist", "mental health", "counselor", "counselling",
"counseling", "therapist", "therapy", "cognitive science", "behavioral science",
"clinical psychology", "neuropsychology", "wellness coach", "well-being",
"wellbeing", "social worker", "social work", "occupational therapy",
"organizational psychology", "school counselor", "rehabilitation specialist",
"psychometrics", "behavioral researcher",
],
"B.Sc. Environmental Science": [
"environmental science", "ecology", "ecologist", "sustainability",
"climate change", "climate analyst", "conservation", "environmental consultant",
"pollution control", "renewable energy", "GIS analyst", "geoscience",
"green energy", "carbon footprint", "biodiversity", "environmental analyst",
"environmental engineer", "water quality", "waste management", "solar energy",
"environmental policy", "LEED", "carbon credit", "sustainability analyst",
"environment", "environmental", "environmental intern", "environmental internship",
],
"B.A. Philosophy": [
"philosophy", "philosophical", "ethics researcher", "ethicist",
"epistemology", "humanities researcher", "liberal arts", "logic analyst",
"sociology", "sociologist", "history", "historian", "historical",
],
"B.A. Politics and International Relations": [
"political science", "politics", "international relations", "policy analyst",
"policy research", "diplomat", "diplomacy", "governance", "public affairs",
"foreign affairs", "geopolitics", "think tank", "government relations",
"foreign policy", "political analyst", "international affairs",
"UN intern", "united nations", "parliamentary", "advocacy",
"policy advisor", "political researcher", "research assistant", "research intern",
],
# ══ SOB — School of Business ══════════════════════════════════════════════
"BBA Digital Marketing": [
"digital marketing", "SEO", "SEM", "search engine optimization", "PPC",
"pay per click", "Google ads", "Facebook ads", "social media marketing",
"content marketing", "performance marketing", "email marketing",
"growth hacking", "influencer marketing", "affiliate marketing",
"programmatic advertising", "marketing automation", "social media manager",
"digital advertising", "paid media", "inbound marketing",
],
"BBA Capital Markets": [
"capital markets", "equity research", "investment banking", "trading analyst",
"stock market", "securities analyst", "portfolio management",
"wealth management", "derivatives", "fixed income", "Bloomberg terminal",
"asset management", "fund management", "stockbroker", "quantitative analyst",
"quant analyst", "credit analyst", "equity analyst",
],
"BBA Business Intelligence and Data Analytics": [
"business intelligence", "BI analyst", "BI developer", "business analyst",
"SQL analyst", "Tableau", "Power BI", "data visualization", "reporting analyst",
"MIS analyst", "market research analyst", "analytics consultant",
"insights analyst", "business analytics", "Looker", "dashboard analyst",
],
"BBA Finance": [
"financial analyst", "financial modeling", "FP&A", "financial planning",
"corporate finance", "budgeting analyst", "financial reporting",
"investment analyst", "financial controller", "finance intern",
"fund accounting", "valuation analyst", "M&A analyst",
"private equity", "venture capital", "due diligence",
],
"BBA Human Resources": [
"human resources", "HR", "recruiter", "talent acquisition", "people operations",
"HRBP", "HR analyst", "HR intern", "workforce planning", "employee engagement",
"learning and development", "compensation analyst", "payroll analyst",
"organizational development", "HR operations", "talent management",
"HR generalist", "people analytics",
],
"BBA Marketing": [
"marketing", "brand management", "brand associate", "marketing coordinator",
"marketing intern", "campaign management", "advertising", "public relations",
"PR executive", "brand strategy", "product marketing", "go-to-market",
"market research", "marketing manager", "brand manager",
],
"BBA Business (General)": [
"business development", "operations analyst", "management trainee",
"sales executive", "business operations", "supply chain analyst",
"logistics coordinator", "account manager", "client relations",
"customer success", "CRM analyst", "key account manager",
"strategy analyst", "operations management", "project coordinator",
],
"B.Com. Accounting and Commerce": [
"accounting", "accountant", "taxation", "bookkeeping", "auditor",
"chartered accountant", "CA intern", "GST consultant", "tally",
"SAP finance", "cost accounting", "financial accounting", "accounts executive",
"accounts payable", "accounts receivable", "tax analyst", "tax consultant",
"statutory audit", "internal audit", "finance executive",
"banking intern", "insurance analyst",
],
"B.Com. ACCA International Accounting": [
"ACCA", "international accounting", "financial reporting", "IFRS", "US GAAP",
"assurance", "external audit", "Big 4", "big four", "transfer pricing",
"forensic accounting",
],
# MBA Data and AI keywords are intentionally management/product-level,
# not engineering-level — technical ML/AI terms live in SOCSE Data Science.
"MBA Data and AI": [
"AI strategy", "data science manager", "ML product manager",
"AI product manager", "analytics lead", "head of analytics",
"data platform manager", "MLOps manager", "AI governance",
"data science lead", "analytics director",
],
"MBA Finance": [
"investment manager", "portfolio manager", "fund manager", "financial planner",
"CFO", "finance manager", "treasury manager", "financial strategy",
"wealth advisor", "financial services manager", "banking strategy",
"credit risk manager", "asset management director",
],
"MBA Management": [
"management consultant", "strategy consultant", "management consulting",
"product manager", "program manager", "general manager", "chief of staff",
"strategic planning", "business strategy", "startup", "entrepreneurship",
"venture", "COO", "operations director",
],
# ══ SODI — School of Design and Innovation ════════════════════════════════
# Note: "product designer" intentionally appears in both UX and Product/Industrial
# because the title is ambiguous across software and hardware companies.
"B.Des. User Experience": [
"ux designer", "user experience designer", "ui/ux", "ui ux", "UX researcher",
"interaction designer", "figma", "prototyping", "wireframing",
"usability testing", "design systems", "HCI", "information architecture",
"user research", "design thinking", "product designer",
],
"B.Des. Interior Environments": [
"interior design", "interior designer", "interior decorator", "space design",
"architectural design", "spatial design", "interior architect",
"hospitality design", "retail design", "AutoCAD", "SketchUp", "Revit",
"furniture designer", "space planner",
],
"B.Des. Communication and New Media": [
"graphic designer", "graphic design", "communication design",
"visual designer", "brand designer", "typography", "illustrator",
"motion graphics", "motion designer", "visual communication",
"advertising design", "print design", "InDesign", "After Effects",
"creative director", "art director",
],
"B.Des. Product and Industrial Design": [
"industrial designer", "industrial design", "3D designer", "CAD designer",
"SolidWorks", "Rhino3D", "manufacturing design", "consumer product design",
"hardware design", "packaging designer", "product designer",
],
"B.Des. Transdisciplinary Design": [
"design researcher", "service design", "systems design", "design strategy",
"innovation design", "social innovation", "design lead", "design strategist",
"design", "designer", "design intern", "design internship", "creative intern",
],
# ══ SoEPP — School of Economics and Public Policy ═════════════════════════
"B.Sc. Economics with Data Analytics": [
"economics", "economist", "econometrics", "economic analysis",
"quantitative economics", "economic research", "economic modelling",
"macroeconomics", "microeconomics", "research economist",
],
"B.Sc. Economics with Development Studies": [
"development economics", "social development", "international development",
"poverty alleviation", "development studies", "SDG", "rural development",
"development sector", "non-profit", "UNICEF", "World Bank intern",
"development finance", "development", "development intern",
],
"M.A. Public Policy and e-Governance": [
"public policy", "policy analyst", "policy research", "governance",
"e-governance", "think tank", "policy advocacy", "regulatory affairs",
"public administration", "policy advisor", "regulatory policy",
"digital governance", "civic tech", "government policy", "policy",
"policy intern", "government", "government intern", "research",
"research intern", "public relations", "public relations intern",
],
# ══ SOCSE — School of Computer Science and Engineering ════════════════════
"B.Tech. / B.Sc. Computer Science and Engineering": [
"software", "developer", "engineer", "programmer", "coder", "coding", "cs", "computer science",
"cyber", "security", "qa", "frontend", "backend", "fullstack", "full stack", "cloud", "devops",
"sde", "swe", "it", "web development", "app development", "mobile development", "android", "ios",
"react", "node", "python", "java", "c++", "golang", "flutter", "aws", "azure", "gcp",
"testing", "blockchain", "web3", "systems engineer", "network engineer", "site reliability", "sre",
"hardware", "embedded",
"software engineer", "software developer", "SWE", "SDE",
"backend developer", "backend engineer", "frontend developer",
"frontend engineer", "full stack", "fullstack", "full-stack developer",
"web developer", "web engineer", "python developer", "java developer",
"node.js developer", "react developer", "angular developer",
"DevOps engineer", "cloud engineer", "platform engineer",
"site reliability engineer", "SRE", "embedded engineer",
"systems engineer", "mobile developer", "iOS developer", "android developer",
"Flutter developer", "React Native developer", "engineering intern",
"software intern", "developer intern", "tech intern",
"QA engineer", "quality assurance engineer", "security engineer",
"blockchain developer", "game programmer", "React JS Developer"
],
"B.Sc. Data Science": [
"data", "ml", "ai", "artificial intelligence", "machine learning", "analytics", "nlp",
"data analyst", "data engineer", "data science", "computer vision", "quality assurance",
"data scientist", "machine learning engineer", "ML engineer",
"AI engineer", "deep learning", "natural language processing", "NLP engineer",
"computer vision engineer", "neural network", "predictive modeling",
"feature engineering", "TensorFlow", "PyTorch", "scikit-learn",
"data analyst", "data engineer", "ETL developer", "data pipeline",
"data mining", "statistical modeling", "machine learning",
"artificial intelligence", "generative AI", "React JS Developer"
],
"BCA Computer Applications": [
"computer applications", "IT support engineer", "technical support",
"system administrator", "network administrator", "database administrator",
"DBA intern", "IT intern", "help desk", "desktop support", "React JS Developer"
],
# ══ SOFMCA — School of Film, Media and Creative Arts ══════════════════════
"B.Sc. Filmmaking": [
"filmmaker", "film director", "cinematographer", "film production",
"video production", "video editor", "post-production", "DOP",
"screenwriter", "scriptwriter", "storyboard artist", "documentary filmmaker",
"cinematography", "production assistant", "film crew",
],
"B.Sc. Animation, VFX and Gaming": [
"animator", "2D animator", "3D animator", "VFX artist", "visual effects",
"3D artist", "game designer", "game developer", "Unity developer",
"Unreal Engine developer", "motion capture", "character rigger",
"concept artist", "gaming", "3D animation", "compositing artist",
"Blender", "Maya", "ZBrush", "level designer", "game artist",
],
"B.A. Media and Journalism": [
"journalist", "reporter", "news writer", "content writer", "copywriter",
"content creator", "editorial", "broadcast journalist", "media relations",
"communications executive", "digital media", "social media executive",
"news anchor", "sub-editor", "online media", "media analyst",
],
"B.A. Acting": [
"actor", "actress", "theatre", "stage performer", "casting coordinator",
"performing arts", "drama teacher", "voice artist", "voice over artist",
"screen acting",
],
# ══ SOLaw — School of Law ════════════════════════════════════════════════
"LL.B. Law": [
"legal intern", "law intern", "paralegal", "lawyer", "attorney",
"legal researcher", "legal analyst", "corporate law", "legal counsel",
"in-house counsel", "associate lawyer", "legal associate", "law clerk",
"legal compliance officer", "contract management", "intellectual property",
"corporate counsel", "legal advisory", "legal officer", "litigation",
"legal drafting", "law", "legal", "lawyer", "advocate", "court",
"legal internship", "law internship", "law/legal", "legal compliance-intern",
"compliance internship",
],
"B.Sc. Criminology, Cyber Law and Forensic Sciences": [
"cyber law", "cybersecurity analyst", "forensic analyst", "digital forensics",
"criminology", "crime analyst", "forensic science", "cybercrime investigator",
"privacy law", "data protection officer", "GDPR compliance",
"security analyst", "cyber compliance", "incident response analyst",
"threat intelligence analyst", "infosec", "information security",
],
# ══ SOAHP — School of Allied and Healthcare Professions ══════════════════
"B.Sc. Cardiac Care Technology": [
"cardiac technician", "cardiology technician", "ECG technician",
"echocardiography", "cardiac catheterization", "cardiovascular technician",
"cardiac care", "Holter monitoring", "cardiac sonographer",
],
"B.Sc. Anaesthesia and OT Technology": [
"anaesthesia technician", "anesthesia technician",
"operation theatre technician", "OT technician", "surgical technician",
"perioperative technician", "scrub technician", "OT assistant",
],
"B.Sc. Medical Laboratory Technology": [
"medical laboratory technician", "lab technician", "clinical laboratory",
"pathology laboratory", "microbiology technician", "hematology technician",
"phlebotomist", "medical lab technician", "biochemistry technician",
"blood bank technician", "histopathology", "healthcare", "medical",
"clinical", "laboratory", "nursing", "public health", "clinical research",
"hospital administration", "pharma", "nurse", "pharmaceutical", "health",
"healthcare intern", "medical intern", "nursing intern", "pharma intern",
],
}
# ── Module-level invariant check ──────────────────────────────────────────────
_registered = {p for data in SCHOOLS.values() for p in data["programs"]}
_keyed = set(PROGRAM_KEYWORDS.keys())
assert _registered == _keyed, (
f"SCHOOLS/PROGRAM_KEYWORDS mismatch — missing keys: {_registered ^ _keyed}"
)
# ── Pre-compiled patterns (built once at import) ──────────────────────────────
# Uses negative lookbehind/lookahead for \w so "java" never fires on "javascript"
# and "sql" never fires on "mysql".
_COMPILED: dict[str, list[re.Pattern[str]]] = {
prog: [
re.compile(r"(?<!\w)" + re.escape(kw.lower()) + r"(?!\w)")
for kw in keywords
]
for prog, keywords in PROGRAM_KEYWORDS.items()
}
# ── Program → school lookup ───────────────────────────────────────────────────
_PROG_TO_SCHOOL: dict[str, list[str]] = {}
for code, data in SCHOOLS.items():
for prog in data["programs"]:
if prog not in _PROG_TO_SCHOOL:
_PROG_TO_SCHOOL[prog] = []
_PROG_TO_SCHOOL[prog].append(code)
# ── Public API ────────────────────────────────────────────────────────────────
def classify_job(title: str, company: str, threshold: int = 1) -> dict:
"""Return matched programs and parent schools for a job.
Args:
title: Job title (may be None — handled gracefully).
company: Company name (may be None — handled gracefully).
threshold: Minimum keyword-hit count to count as a match. Default 1.
Returns:
{
"programs": list[str], # matched program names, score-descending
"schools": list[str], # unique parent school codes, insertion-ordered
}
"""
text = f"{title or ''} {company or ''}".lower()
scores: dict[str, int] = {
prog: sum(1 for pat in patterns if pat.search(text))
for prog, patterns in _COMPILED.items()
}
matched = [p for p, s in scores.items() if s >= threshold]
# Sort matched programs by score descending so the best fits appear first.
matched.sort(key=lambda p: scores[p], reverse=True)
# Deduplicated school codes, preserving matched order.
schools = []
for p in matched:
for school_code in _PROG_TO_SCHOOL[p]:
if school_code not in schools:
schools.append(school_code)
return {"programs": matched, "schools": schools}
|