Token Classification
Transformers
ONNX
Safetensors
English
distilbert
resume-parsing
ner
resume
cv
information-extraction
Instructions to use oksomu/resume-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oksomu/resume-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="oksomu/resume-ner")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("oksomu/resume-ner") model = AutoModelForTokenClassification.from_pretrained("oksomu/resume-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Somasundaram Ayyappan Claude Opus 4.6 (1M context) commited on
Commit ·
a05717f
1
Parent(s): e6b7b6f
Extract city_country_map to separate file with 317 cities
Browse filesMoved from inline resume_config.json (54 entries) to dedicated
city_country_map.json (317 entries) organized by region. Added coverage
for India (45 cities), US (80+), UK (25), Canada, Germany, France,
Australia, East/Southeast Asia, Middle East, and broader Europe.
Post-processor loads from file path in config, falls back to inline map.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- city_country_map.json +133 -0
- resume_config.json +1 -23
- training/structured_postprocess.py +13 -1
city_country_map.json
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"india": {
|
| 3 |
+
"bangalore": "India", "bengaluru": "India", "mumbai": "India", "delhi": "India",
|
| 4 |
+
"new delhi": "India", "hyderabad": "India", "chennai": "India", "pune": "India",
|
| 5 |
+
"kolkata": "India", "ahmedabad": "India", "noida": "India", "gurgaon": "India",
|
| 6 |
+
"gurugram": "India", "jaipur": "India", "kochi": "India", "indore": "India",
|
| 7 |
+
"chandigarh": "India", "lucknow": "India", "nagpur": "India", "bhopal": "India",
|
| 8 |
+
"visakhapatnam": "India", "coimbatore": "India", "thiruvananthapuram": "India",
|
| 9 |
+
"mysore": "India", "mysuru": "India", "mangalore": "India", "mangaluru": "India",
|
| 10 |
+
"surat": "India", "vadodara": "India", "rajkot": "India", "nashik": "India",
|
| 11 |
+
"patna": "India", "ranchi": "India", "bhubaneswar": "India", "guwahati": "India",
|
| 12 |
+
"dehradun": "India", "madurai": "India", "tiruchirappalli": "India",
|
| 13 |
+
"trichy": "India", "warangal": "India", "surathkal": "India",
|
| 14 |
+
"vellore": "India", "manipal": "India", "pilani": "India",
|
| 15 |
+
"kharagpur": "India", "kanpur": "India", "roorkee": "India"
|
| 16 |
+
},
|
| 17 |
+
"united_states": {
|
| 18 |
+
"new york": "United States", "los angeles": "United States", "chicago": "United States",
|
| 19 |
+
"houston": "United States", "phoenix": "United States", "philadelphia": "United States",
|
| 20 |
+
"san antonio": "United States", "san diego": "United States", "dallas": "United States",
|
| 21 |
+
"san jose": "United States", "austin": "United States", "jacksonville": "United States",
|
| 22 |
+
"san francisco": "United States", "columbus": "United States", "indianapolis": "United States",
|
| 23 |
+
"fort worth": "United States", "charlotte": "United States", "seattle": "United States",
|
| 24 |
+
"denver": "United States", "nashville": "United States", "oklahoma city": "United States",
|
| 25 |
+
"washington": "United States", "el paso": "United States", "boston": "United States",
|
| 26 |
+
"portland": "United States", "las vegas": "United States", "memphis": "United States",
|
| 27 |
+
"louisville": "United States", "baltimore": "United States", "milwaukee": "United States",
|
| 28 |
+
"albuquerque": "United States", "tucson": "United States", "fresno": "United States",
|
| 29 |
+
"sacramento": "United States", "mesa": "United States", "atlanta": "United States",
|
| 30 |
+
"kansas city": "United States", "colorado springs": "United States",
|
| 31 |
+
"omaha": "United States", "raleigh": "United States", "miami": "United States",
|
| 32 |
+
"minneapolis": "United States", "tampa": "United States", "new orleans": "United States",
|
| 33 |
+
"cleveland": "United States", "pittsburgh": "United States", "cincinnati": "United States",
|
| 34 |
+
"st. louis": "United States", "saint louis": "United States", "detroit": "United States",
|
| 35 |
+
"salt lake city": "United States", "honolulu": "United States",
|
| 36 |
+
"mountain view": "United States", "palo alto": "United States", "menlo park": "United States",
|
| 37 |
+
"cupertino": "United States", "redmond": "United States", "boulder": "United States",
|
| 38 |
+
"cambridge": "United States", "santa monica": "United States", "irvine": "United States",
|
| 39 |
+
"sunnyvale": "United States", "santa clara": "United States", "berkeley": "United States",
|
| 40 |
+
"ann arbor": "United States", "madison": "United States", "durham": "United States",
|
| 41 |
+
"chapel hill": "United States", "provo": "United States", "pasadena": "United States",
|
| 42 |
+
"scottsdale": "United States", "bellevue": "United States", "kirkland": "United States",
|
| 43 |
+
"plano": "United States", "arlington": "United States", "lexington": "United States",
|
| 44 |
+
"waltham": "United States", "el segundo": "United States", "hawthorne": "United States",
|
| 45 |
+
"redondo beach": "United States", "fort collins": "United States",
|
| 46 |
+
"san mateo": "United States", "los gatos": "United States",
|
| 47 |
+
"college station": "United States", "west lafayette": "United States",
|
| 48 |
+
"university park": "United States", "ithaca": "United States",
|
| 49 |
+
"marysville": "United States", "dublin": "United States"
|
| 50 |
+
},
|
| 51 |
+
"united_kingdom": {
|
| 52 |
+
"london": "United Kingdom", "manchester": "United Kingdom", "birmingham": "United Kingdom",
|
| 53 |
+
"glasgow": "United Kingdom", "liverpool": "United Kingdom", "edinburgh": "United Kingdom",
|
| 54 |
+
"leeds": "United Kingdom", "bristol": "United Kingdom", "sheffield": "United Kingdom",
|
| 55 |
+
"newcastle": "United Kingdom", "nottingham": "United Kingdom", "cardiff": "United Kingdom",
|
| 56 |
+
"belfast": "United Kingdom", "leicester": "United Kingdom", "coventry": "United Kingdom",
|
| 57 |
+
"oxford": "United Kingdom", "cambridge": "United Kingdom", "reading": "United Kingdom",
|
| 58 |
+
"southampton": "United Kingdom", "brighton": "United Kingdom", "bath": "United Kingdom",
|
| 59 |
+
"york": "United Kingdom", "exeter": "United Kingdom", "dundee": "United Kingdom",
|
| 60 |
+
"aberdeen": "United Kingdom", "malmo": "United Kingdom"
|
| 61 |
+
},
|
| 62 |
+
"canada": {
|
| 63 |
+
"toronto": "Canada", "vancouver": "Canada", "montreal": "Canada", "calgary": "Canada",
|
| 64 |
+
"edmonton": "Canada", "ottawa": "Canada", "winnipeg": "Canada", "quebec city": "Canada",
|
| 65 |
+
"hamilton": "Canada", "kitchener": "Canada", "waterloo": "Canada", "halifax": "Canada",
|
| 66 |
+
"victoria": "Canada", "london": "Canada", "saskatoon": "Canada", "regina": "Canada"
|
| 67 |
+
},
|
| 68 |
+
"germany": {
|
| 69 |
+
"berlin": "Germany", "munich": "Germany", "frankfurt": "Germany", "hamburg": "Germany",
|
| 70 |
+
"cologne": "Germany", "dusseldorf": "Germany", "stuttgart": "Germany", "dortmund": "Germany",
|
| 71 |
+
"essen": "Germany", "leipzig": "Germany", "bremen": "Germany", "dresden": "Germany",
|
| 72 |
+
"hannover": "Germany", "nuremberg": "Germany", "wroclaw": "Germany", "krakow": "Germany",
|
| 73 |
+
"heidelberg": "Germany", "karlsruhe": "Germany", "bonn": "Germany"
|
| 74 |
+
},
|
| 75 |
+
"france": {
|
| 76 |
+
"paris": "France", "marseille": "France", "lyon": "France", "toulouse": "France",
|
| 77 |
+
"nice": "France", "nantes": "France", "strasbourg": "France", "montpellier": "France",
|
| 78 |
+
"bordeaux": "France", "lille": "France", "rennes": "France", "grenoble": "France"
|
| 79 |
+
},
|
| 80 |
+
"australia": {
|
| 81 |
+
"sydney": "Australia", "melbourne": "Australia", "brisbane": "Australia",
|
| 82 |
+
"perth": "Australia", "adelaide": "Australia", "canberra": "Australia",
|
| 83 |
+
"gold coast": "Australia", "hobart": "Australia", "auckland": "New Zealand",
|
| 84 |
+
"wellington": "New Zealand", "christchurch": "New Zealand"
|
| 85 |
+
},
|
| 86 |
+
"east_asia": {
|
| 87 |
+
"tokyo": "Japan", "osaka": "Japan", "yokohama": "Japan", "kyoto": "Japan",
|
| 88 |
+
"nagoya": "Japan", "fukuoka": "Japan", "sapporo": "Japan",
|
| 89 |
+
"seoul": "South Korea", "busan": "South Korea", "incheon": "South Korea",
|
| 90 |
+
"beijing": "China", "shanghai": "China", "shenzhen": "China", "guangzhou": "China",
|
| 91 |
+
"hangzhou": "China", "chengdu": "China", "nanjing": "China", "wuhan": "China",
|
| 92 |
+
"xi'an": "China", "tianjin": "China", "suzhou": "China",
|
| 93 |
+
"taipei": "Taiwan", "hong kong": "Hong Kong"
|
| 94 |
+
},
|
| 95 |
+
"southeast_asia": {
|
| 96 |
+
"singapore": "Singapore",
|
| 97 |
+
"bangkok": "Thailand", "chiang mai": "Thailand",
|
| 98 |
+
"kuala lumpur": "Malaysia", "penang": "Malaysia", "johor bahru": "Malaysia",
|
| 99 |
+
"jakarta": "Indonesia", "bali": "Indonesia", "surabaya": "Indonesia",
|
| 100 |
+
"manila": "Philippines", "cebu": "Philippines",
|
| 101 |
+
"ho chi minh city": "Vietnam", "hanoi": "Vietnam",
|
| 102 |
+
"sao paulo": "Brazil", "rio de janeiro": "Brazil",
|
| 103 |
+
"lagos": "Nigeria", "nairobi": "Kenya", "cape town": "South Africa",
|
| 104 |
+
"johannesburg": "South Africa"
|
| 105 |
+
},
|
| 106 |
+
"middle_east": {
|
| 107 |
+
"dubai": "UAE", "abu dhabi": "UAE", "sharjah": "UAE",
|
| 108 |
+
"riyadh": "Saudi Arabia", "jeddah": "Saudi Arabia",
|
| 109 |
+
"doha": "Qatar", "muscat": "Oman", "manama": "Bahrain",
|
| 110 |
+
"tel aviv": "Israel", "haifa": "Israel", "jerusalem": "Israel"
|
| 111 |
+
},
|
| 112 |
+
"europe_other": {
|
| 113 |
+
"amsterdam": "Netherlands", "rotterdam": "Netherlands", "the hague": "Netherlands",
|
| 114 |
+
"eindhoven": "Netherlands", "utrecht": "Netherlands",
|
| 115 |
+
"stockholm": "Sweden", "gothenburg": "Sweden", "malmo": "Sweden",
|
| 116 |
+
"dublin": "Ireland", "cork": "Ireland", "galway": "Ireland",
|
| 117 |
+
"zurich": "Switzerland", "geneva": "Switzerland", "bern": "Switzerland", "basel": "Switzerland",
|
| 118 |
+
"barcelona": "Spain", "madrid": "Spain", "valencia": "Spain", "seville": "Spain",
|
| 119 |
+
"lisbon": "Portugal", "porto": "Portugal",
|
| 120 |
+
"rome": "Italy", "milan": "Italy", "turin": "Italy", "florence": "Italy",
|
| 121 |
+
"vienna": "Austria", "graz": "Austria",
|
| 122 |
+
"brussels": "Belgium", "antwerp": "Belgium",
|
| 123 |
+
"copenhagen": "Denmark", "aarhus": "Denmark",
|
| 124 |
+
"oslo": "Norway", "bergen": "Norway",
|
| 125 |
+
"helsinki": "Finland", "espoo": "Finland",
|
| 126 |
+
"warsaw": "Poland", "krakow": "Poland", "wroclaw": "Poland", "gdansk": "Poland",
|
| 127 |
+
"prague": "Czech Republic", "brno": "Czech Republic",
|
| 128 |
+
"budapest": "Hungary", "bucharest": "Romania",
|
| 129 |
+
"tallinn": "Estonia", "riga": "Latvia", "vilnius": "Lithuania",
|
| 130 |
+
"athens": "Greece", "thessaloniki": "Greece",
|
| 131 |
+
"istanbul": "Turkey", "ankara": "Turkey"
|
| 132 |
+
}
|
| 133 |
+
}
|
resume_config.json
CHANGED
|
@@ -151,27 +151,5 @@
|
|
| 151 |
}
|
| 152 |
}
|
| 153 |
},
|
| 154 |
-
"
|
| 155 |
-
"bangalore": "India", "bengaluru": "India", "mumbai": "India", "delhi": "India",
|
| 156 |
-
"new delhi": "India", "hyderabad": "India", "chennai": "India", "pune": "India",
|
| 157 |
-
"kolkata": "India", "ahmedabad": "India", "noida": "India", "gurgaon": "India",
|
| 158 |
-
"gurugram": "India", "jaipur": "India", "kochi": "India", "indore": "India",
|
| 159 |
-
"san francisco": "United States", "new york": "United States", "seattle": "United States",
|
| 160 |
-
"austin": "United States", "boston": "United States", "chicago": "United States",
|
| 161 |
-
"los angeles": "United States", "denver": "United States", "portland": "United States",
|
| 162 |
-
"dallas": "United States", "houston": "United States", "atlanta": "United States",
|
| 163 |
-
"miami": "United States", "philadelphia": "United States", "san jose": "United States",
|
| 164 |
-
"mountain view": "United States", "palo alto": "United States", "menlo park": "United States",
|
| 165 |
-
"cupertino": "United States", "redmond": "United States", "boulder": "United States",
|
| 166 |
-
"cambridge": "United States", "raleigh": "United States", "pittsburgh": "United States",
|
| 167 |
-
"london": "United Kingdom", "manchester": "United Kingdom", "edinburgh": "United Kingdom",
|
| 168 |
-
"toronto": "Canada", "vancouver": "Canada", "montreal": "Canada",
|
| 169 |
-
"berlin": "Germany", "munich": "Germany", "frankfurt": "Germany",
|
| 170 |
-
"paris": "France", "amsterdam": "Netherlands", "stockholm": "Sweden",
|
| 171 |
-
"dublin": "Ireland", "zurich": "Switzerland", "barcelona": "Spain",
|
| 172 |
-
"singapore": "Singapore", "tokyo": "Japan", "seoul": "South Korea",
|
| 173 |
-
"beijing": "China", "shanghai": "China", "shenzhen": "China",
|
| 174 |
-
"dubai": "UAE", "sydney": "Australia", "melbourne": "Australia",
|
| 175 |
-
"tel aviv": "Israel", "auckland": "New Zealand"
|
| 176 |
-
}
|
| 177 |
}
|
|
|
|
| 151 |
}
|
| 152 |
}
|
| 153 |
},
|
| 154 |
+
"city_country_map_file": "city_country_map.json"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
}
|
training/structured_postprocess.py
CHANGED
|
@@ -45,6 +45,18 @@ class StructuredPostProcessor:
|
|
| 45 |
self.country_name_aliases = self.config.get("country_name_aliases", {})
|
| 46 |
self.seniority_by_exp_count = self.config.get("seniority_by_experience_count", {"Senior": 4, "Mid": 2, "Junior": 0})
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
def build_structured_resume_from_spans(self, spans: list[Span], raw_text: str = "") -> dict:
|
| 49 |
spans = [Span(**{**span.__dict__, "text": self.clean_entity(span.label, span.text) or ""}) for span in spans]
|
| 50 |
spans = [span for span in spans if span.text]
|
|
@@ -365,7 +377,7 @@ class StructuredPostProcessor:
|
|
| 365 |
for alias, country in self.country_name_aliases.items():
|
| 366 |
if alias in loc:
|
| 367 |
return country
|
| 368 |
-
for city, country in self.
|
| 369 |
if city in loc:
|
| 370 |
return country
|
| 371 |
for part in loc.replace(",", " ").split():
|
|
|
|
| 45 |
self.country_name_aliases = self.config.get("country_name_aliases", {})
|
| 46 |
self.seniority_by_exp_count = self.config.get("seniority_by_experience_count", {"Senior": 4, "Mid": 2, "Junior": 0})
|
| 47 |
|
| 48 |
+
self.city_country_map = {}
|
| 49 |
+
ccm_file = self.config.get("city_country_map_file")
|
| 50 |
+
if ccm_file:
|
| 51 |
+
ccm_path = self.model_dir / ccm_file
|
| 52 |
+
if ccm_path.exists():
|
| 53 |
+
with open(ccm_path) as fh:
|
| 54 |
+
data = json.load(fh)
|
| 55 |
+
for region in data.values():
|
| 56 |
+
self.city_country_map.update(region)
|
| 57 |
+
if not self.city_country_map:
|
| 58 |
+
self.city_country_map = self.config.get("city_country_map", {})
|
| 59 |
+
|
| 60 |
def build_structured_resume_from_spans(self, spans: list[Span], raw_text: str = "") -> dict:
|
| 61 |
spans = [Span(**{**span.__dict__, "text": self.clean_entity(span.label, span.text) or ""}) for span in spans]
|
| 62 |
spans = [span for span in spans if span.text]
|
|
|
|
| 377 |
for alias, country in self.country_name_aliases.items():
|
| 378 |
if alias in loc:
|
| 379 |
return country
|
| 380 |
+
for city, country in self.city_country_map.items():
|
| 381 |
if city in loc:
|
| 382 |
return country
|
| 383 |
for part in loc.replace(",", " ").split():
|