Skip to content

Instantly share code, notes, and snippets.

@rsalaza4
Created March 20, 2024 18:17
Show Gist options
  • Save rsalaza4/dcb5a0dfc4487c2f243abc26826cedbe to your computer and use it in GitHub Desktop.
Save rsalaza4/dcb5a0dfc4487c2f243abc26826cedbe to your computer and use it in GitHub Desktop.
class Resume:
def __init__(self, text):
self.text = text
self.firstName = ""
self.lastName = ""
self.emailAddress = ""
self.universities = []
def get_first_name(self):
firstWords = self.text.split()[:10]
for word in firstWords:
if word.isdigit() == False and word[0].isupper() == True and word.lower() not in ["page", "last", "updated"] and len(word) > 1:
self.firstName = word
break
def get_last_name(self):
firstWords = self.text.split()[self.text.split().index(self.firstName)+1:10]
for word in firstWords:
if word.isdigit() == False and word[0].isupper() == True and word.lower() not in ["page", "last", "updated"] and len(word) > 1:
self.lastName = word
break
def get_email(self):
match = re.search(r'[\w.+-]+@[\w-]+\.[\w.-]+', self.text)
self.emailAddress = match.group(0)
def get_univerisities(self):
university_matches = re.findall(university_patterns, self.text)
universities_to_remove = ["University","University "," University"," University ","College"]
self.universities = list(set(university_matches))
for university in universities_to_remove:
try:
self.universities.remove(university)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment