Codingo / backend /models /resume_parser /resume_to_features.py
husseinelsaadi's picture
Flask integrated and adjusted applying
504df0f
raw
history blame
1.08 kB
import os
from pyresparser import ResumeParser
def extract_resume_features(resume_path):
"""
Extract features from a resume file.
Args:
resume_path (str): Path to the resume file
Returns:
dict: Dictionary containing extracted features from resume
"""
try:
data = ResumeParser(resume_path).get_extracted_data()
return data
except Exception as e:
print(f"Error parsing resume: {e}")
return {
'name': '',
'email': '',
'mobile_number': '',
'skills': [],
'experience': [],
'no_of_pages': 0,
'total_experience': 0
}
# Example usage (will run if script is executed directly)
if __name__ == "__main__":
# Build absolute path to the resume file
current_dir = os.path.dirname(os.path.abspath(__file__))
resume_path = os.path.join(current_dir, '../../../data/resumes/Hussein El Saadi - CV.pdf')
# Parse and print the extracted data
data = extract_resume_features(resume_path)
print(data)