@@ -217,80 +217,20 @@ def get_month_index(month):
217
217
"""
218
218
219
219
Utility function that fetches Job Position from the resume.
220
- Params: resume_text type : string
221
- returns: job type:string
220
+ Params: cleaned_resume Type : string
221
+ returns: job_positions Type:List
222
222
223
223
"""
224
- def fetch_job ( resume_text ):
224
+ def fetch_jobs ( cleaned_resume ):
225
225
positions_path = dirpath .PKGPATH + '/data/job_positions/positions'
226
+ with open (positions_path , 'rb' ) as fp :
227
+ jobs = pickle .load (fp )
226
228
227
-
228
-
229
- pincodes = set ()
230
- states = set ()
231
- district_states = {}
232
- address = {}
233
- result_address = {}
234
- initial_resume_text = resume_text
235
-
236
- with open (pincode_input_path , 'rb' ) as fp :
237
- pincodes = pickle .load (fp )
238
- with open (address_input_path ,'rb' ) as fp :
239
- address = pickle .load (fp )
240
-
241
- regular_expression = re .compile (regex .pincode )
242
- regex_result = re .search (regular_expression ,resume_text )
243
- while regex_result :
244
- useful_resume_text = resume_text [:regex_result .start ()].lower ()
245
- pincode_tuple = regex_result .group ()
246
- pincode = ''
247
- for i in pincode_tuple :
248
- if (i <= '9' ) and (i >= '0' ):
249
- pincode += str (i )
250
- if pincode in pincodes :
251
- result_address ['pincode' ] = pincode
252
- result_address ['state' ] = address [pincode ]['state' ].title ()
253
- result_address ['district' ] = address [pincode ]['district' ].title ()
254
- return result_address
255
-
256
- result_address .clear ()
257
- resume_text = resume_text [regex_result .end ():]
258
- regex_result = re .search (regular_expression ,resume_text )
259
-
260
- resume_text = initial_resume_text .lower ()
261
-
262
- with open (states_input ,'rb' ) as fp :
263
- states = pickle .load (fp )
264
- with open (district_state_input ,'rb' ) as fp :
265
- district_states = pickle .load (fp )
266
-
267
- # Check if the input is a separate word in resume_text
268
- def if_separate_word (pos ,word ):
269
- if (pos != 0 ) and resume_text [pos - 1 ].isalpha ():
270
- return False
271
- final_pos = pos + len (word )
272
- if ( final_pos != len (resume_text )) and resume_text [final_pos ].isalpha ():
273
- return False
274
- return True
275
-
276
- result_state = ''
277
- state_pos = len (resume_text )
278
- result_district = ''
279
- district_pos = len (resume_text )
280
- for state in states :
281
- pos = resume_text .find (state )
282
- if (pos != - 1 ) and (pos < state_pos ) and if_separate_word (pos ,state ):
283
- state_pos = pos
284
- result_state = state
285
- for district in district_states .keys ():
286
- pos = resume_text .find (district )
287
- if (pos != - 1 ) and (pos < district_pos ) and if_separate_word (pos ,district ):
288
- district_pos = pos
289
- result_district = district
290
- if (result_state is '' ) and (result_district is not '' ):
291
- result_state = district_states [result_district ]
292
-
293
- result_address ['pincode' ] = ''
294
- result_address ['district' ] = result_district .title ()
295
- result_address ['state' ] = result_state .title ()
296
- return result_address
229
+ job_positions = []
230
+ for job in jobs :
231
+ if job :
232
+ job = ' ' + job + ' '
233
+ if job .lower () in cleaned_resume :
234
+ job_positions .append (job )
235
+
236
+ return job_positions
0 commit comments