0

I am making a resume parser but I want to know the years of experience of the person from the experience section and want results like if there are 3 years of experience is mentioned and there are 3 companies the person worked in those 3 years and there are the start and end date mentioned on all of them so is there any way to know this is the start date and this is an end date and also can I calculate the total years of experience mentioned in the experience section by adding all those ranges.

Example field

Experience

AI and Machine learning Intern, Dawn DigiTech (04/2022 -present), ❖, This company digitally transform multiple front- and back-office business, processes, SCM, ERP and Manufacturing Excellence., -, SpiceJet(08/2020 - 10/2021), ❖, Leading Indian airlines company worked and Developedy of 30%, Machine learning Intern, TutorBin(02/2022 - 05/2022 ), ❖, Tutorbin is an integrated online tutoring platform serving as a one-stop, solution for students and online tutors. work on Ai and Machine learning, tasks provided by the client, 60%,

This is the parsed experience section so in this I want to extract dates ranges which should know the start date and end date and also return the total experience mentioned which is :

    start date      end date
    (04/2022   -     present)    =  2 months
    (08/2020   -     10/2021)    =  1 year 2months
   (02/2022    -     04/2022)    =  2 months
Total experience  =  1 year 6 months

So, is there any way to get this output in total years of experience and get to know in date range which is the start date and which is the end date?

Thanks in advance.

1 Answers1

0

this is one way to do it but it could be in fractions as well.

from datetime import datetime
from dateutil.relativedelta import relativedelta

def year_delta(date_1, date_2):
    start_day = '01'
    end_day = '30'
    date_1 = f'{start_day}/08/2020'
    date_2 = f'{end_day}/10/2021'
    date_1=datetime.strptime(date_1, '%d/%m/%Y').date()
    date_2=datetime.strptime(date_2, '%d/%m/%Y').date()
    return relativedelta(date_2, date_1).years

See post for fractional ranges.

nandevers
  • 191
  • 8
  • This is not the correct way we don't have any start date and end date to begin with like if there is some other string that has different start dates and end dates so this code will give an error we cannot predefine the dates in this question we need a function that can give start date and end date of any date of any string with different dates and ranges. – Puranjay Kwatra May 14 '22 at 08:26
  • Hi there @PuranjayKwatra, I suppose my answer accounts for part of what you described in your question, specifically here: ```is there any way to get this output in total years of experience``` In order to extract the date (considering they would be a string formated in multiple ways) I suppose you can use a regex as demonstrated in this [post](https://stackoverflow.com/questions/3276180/extracting-date-from-a-string-in-python). I hope it helps :) – nandevers May 14 '22 at 13:50