WebashalarForML commited on
Commit
a2ff716
·
verified ·
1 Parent(s): 2af0077

Update utils/spacy.py

Browse files
Files changed (1) hide show
  1. utils/spacy.py +5 -14
utils/spacy.py CHANGED
@@ -335,9 +335,7 @@ def Parser_from_model(file_path):
335
  "contact": [],
336
  "email": [],
337
  "location": [],
338
- "link": [],
339
- "invalid_email": [],
340
- "invalid_contact": []
341
  },
342
  "professional": {
343
  "technical_skills": [],
@@ -414,23 +412,18 @@ def Parser_from_model(file_path):
414
  # Map entities to result JSON
415
  result['personal']['name'] = normalize_to_list(entities.get('PERSON'))
416
  result['personal']['email'] += cont_data['emails']
417
- result['personal']['invalid_email'] = []
418
 
419
  # Validate email and handle invalid ones
420
  for email in entities.get('EMAIL', []):
421
  if is_valid_email(email):
422
- result['personal']['email'].append(email)
423
- else:
424
- result['personal']['invalid_email'].append(email)
425
 
426
  # Validate contact and handle invalid ones
427
  result['personal']['contact'] += cont_data['phone_numbers']
428
- result['personal']['invalid_contact'] = []
429
  for contact in entities.get('CONTACT', []):
430
  if is_valid_contact(contact):
431
- result['personal']['contact'].append(contact)
432
- else:
433
- result['personal']['invalid_contact'].append(contact)
434
 
435
  result['personal']['location'] = normalize_to_list(entities.get('LOCATION'))
436
  result['personal']['link'] = normalize_to_list(hyperlinks)
@@ -456,6 +449,4 @@ def Parser_from_model(file_path):
456
  education['certificate'] = normalize_to_list(entities.get('CERTIFICATE'))
457
 
458
  print(result)
459
- return result
460
-
461
-
 
335
  "contact": [],
336
  "email": [],
337
  "location": [],
338
+ "link": []
 
 
339
  },
340
  "professional": {
341
  "technical_skills": [],
 
412
  # Map entities to result JSON
413
  result['personal']['name'] = normalize_to_list(entities.get('PERSON'))
414
  result['personal']['email'] += cont_data['emails']
415
+
416
 
417
  # Validate email and handle invalid ones
418
  for email in entities.get('EMAIL', []):
419
  if is_valid_email(email):
420
+ result['personal']['email'].append(email)
 
 
421
 
422
  # Validate contact and handle invalid ones
423
  result['personal']['contact'] += cont_data['phone_numbers']
 
424
  for contact in entities.get('CONTACT', []):
425
  if is_valid_contact(contact):
426
+ result['personal']['contact'].append(contact)
 
 
427
 
428
  result['personal']['location'] = normalize_to_list(entities.get('LOCATION'))
429
  result['personal']['link'] = normalize_to_list(hyperlinks)
 
449
  education['certificate'] = normalize_to_list(entities.get('CERTIFICATE'))
450
 
451
  print(result)
452
+ return result