-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjd_parser.py
More file actions
100 lines (87 loc) · 4.15 KB
/
Copy pathjd_parser.py
File metadata and controls
100 lines (87 loc) · 4.15 KB
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
import json
from rich.console import Console
console = Console()
# 1. Hard-coded known facts for Sherlock hackathon project
KNOWN_REQUIRED = [
'production embeddings', 'sentence-transformers', 'BGE', 'E5', 'vector database',
'Pinecone', 'Weaviate', 'Qdrant', 'Milvus', 'FAISS', 'Elasticsearch',
'ranking evaluation', 'NDCG', 'MRR', 'MAP', 'hybrid search', 'BM25',
'dense retrieval', 'neural reranking'
]
KNOWN_NICE_TO_HAVE = [
'BERT', 'transformers', 'LLM', 'Python', 'MLOps', 'A/B testing',
'product company experience'
]
KNOWN_DISQUALIFIERS = [
'TCS', 'Infosys', 'Wipro', 'Accenture', 'Cognizant', 'Capgemini',
'YOLO', 'OpenCV', 'speech recognition', 'computer vision', 'robotics',
'image classification'
]
ULTRA_RARE_SIGNALS = [
'bm25', 'ndcg', 'mrr', 'embedding', 'bi-encoder', 'cross-encoder',
'dense retrieval', 'sparse retrieval', 'hybrid retrieval', 'reranking',
'ColBERT', 'DPR', 'SPLADE', 'HNSW', 'ANN index', 'vector search',
'recall@k', 'precision@k'
]
def parse_jd(jd_text: str) -> dict:
"""
Since LLMs are prohibited at inference time, we return a deterministic
pre-computed lookup table based on our EDA of the hackathon constraints.
"""
merged_signals = {
"seniority": "senior",
"domain": "search",
"is_product_company": True,
"location_preference": "hybrid",
"yoe_min": 5,
"yoe_max": 9,
"required_skills": KNOWN_REQUIRED,
"nice_to_have_skills": KNOWN_NICE_TO_HAVE,
"disqualifiers": KNOWN_DISQUALIFIERS,
"ultra_rare_signals": ULTRA_RARE_SIGNALS
}
with open('jd_signals.json', 'w', encoding='utf-8') as f:
json.dump(merged_signals, f, indent=2)
return merged_signals
def print_summary_table(merged):
def wrap_text(text, width=74):
words = text.split(', ')
lines, current = [], []
for word in words:
if len(", ".join(current + [word])) > width:
lines.append(", ".join(current) + ",")
current = [word]
else:
current.append(word)
if current:
lines.append(", ".join(current))
return lines
console.print("[cyan]+[/cyan]" + "[cyan]-[/cyan]"*78 + "[cyan]+[/cyan]")
console.print(f"[cyan]|[/cyan] [bold]{'JD SIGNAL SUMMARY (DETERMINISTIC)':^76}[/bold] [cyan]|[/cyan]")
console.print("[cyan]+[/cyan]" + "[cyan]-[/cyan]"*78 + "[cyan]+[/cyan]")
yoe = f"{merged.get('yoe_min', '?')} - {merged.get('yoe_max', '?')}"
console.print(f"[cyan]|[/cyan] Seniority: [yellow]{str(merged['seniority']).upper():<25}[/yellow] | Domain: [yellow]{str(merged['domain']).upper():<29}[/yellow] [cyan]|[/cyan]")
console.print(f"[cyan]|[/cyan] YOE: [yellow]{yoe:<31}[/yellow] | Product Co: [yellow]{str(merged['is_product_company']):<25}[/yellow] [cyan]|[/cyan]")
console.print("[cyan]+[/cyan]" + "[cyan]-[/cyan]"*78 + "[cyan]+[/cyan]")
sections = [
("REQUIRED SKILLS:", merged['required_skills']),
("NICE-TO-HAVE SKILLS:", merged['nice_to_have_skills']),
("DISQUALIFIERS:", merged['disqualifiers']),
("ULTRA RARE SIGNALS (Tier 4/5 markers):", merged['ultra_rare_signals'])
]
for title, items in sections:
console.print(f"[cyan]|[/cyan] [bold green]{title:<76}[/bold green] [cyan]|[/cyan]")
console.print("[cyan]+[/cyan]" + "[cyan]-[/cyan]"*78 + "[cyan]+[/cyan]")
for line in wrap_text(", ".join(items)):
console.print(f"[cyan]|[/cyan] {line:<76} [cyan]|[/cyan]")
console.print("[cyan]+[/cyan]" + "[cyan]-[/cyan]"*78 + "[cyan]+[/cyan]")
console.print("\n [bold green]-> Complete signals saved to 'jd_signals.json'[/bold green]")
if __name__ == "__main__":
sample_jd = (
"We are looking for a Senior AI Engineer at Redrob (founding team) in Pune/Noida "
"(hybrid). Requires 5-9 years of experience. You will build and scale our hybrid "
"search, embedding models, and ranking systems to match candidates with roles."
)
console.print("[cyan]Parsing JD for Sherlock Ranker (Deterministic)...[/cyan]")
merged = parse_jd(sample_jd)
print_summary_table(merged)