Sambhavvvvv commited on
Commit
516014d
·
verified ·
1 Parent(s): f2ebb34

Delete school_classifier.py

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