Last active
March 20, 2024 18:14
-
-
Save rsalaza4/f14e7267093faaa30c8caf2c91d5fd96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_last_name(self): | |
# Split resume text and store up to the first 10 words one position after the index of the string where the first name was found | |
firstWords = self.text.split()[self.text.split().index(self.firstName)+1:10] | |
# Loop through the first 10 words | |
for word in firstWords: | |
# Validate that the word is not a digit and | |
# Validate that the character is an uppercase letter and | |
# Validate that the word is not "page", "last" or "updated" and | |
# Validate that the length of the word is greater than 1 character | |
if word.isdigit() == False and word[0].isupper() == True and word.lower() not in ["page", "last", "updated"] and len(word) > 1: | |
# Assign word to lastName | |
self.lastName = word | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment