Resume Job Matcher is a Python script that automates the process of matching resumes to a job description using AI. It leverages the Anthropic Claude API to analyze resumes and provide a match score along with personalized email responses for candidates.
This tool is designed to streamline the recruitment process by efficiently processing multiple resumes and highlighting the best candidates based on customizable criteria. The script uses advanced natural language processing to compare resume content with job requirements, considering factors such as skills, experience, education, and even personal website content when available.
- Automated Resume Parsing: Extracts text from PDF resumes using
PyPDF2
. - AI-Powered Matching: Utilizes the Claude API to compare resumes with job descriptions.
- Advanced Scoring System: Implements a comprehensive scoring mechanism based on skills, experience, education, certifications, and more.
- Multiprocessing Support: Processes resumes in parallel using all available CPU cores.
- Personalized Communication: Generates professional email responses for candidates.
- Website Content Integration: Includes personal website content in the evaluation if provided.
- Detailed Logging and Error Handling: Provides robust logging and gracefully handles exceptions.
- Interactive Console Output: Displays a fun "resume matching dance" animation during processing.
- Comprehensive Result Summary: Provides a detailed summary of top, average, and bottom scores.
- Dual AI Provider Support: Offers the choice between Anthropic's Claude API and OpenAI's GPT API for AI-powered analysis.
- Fast AI Communication: Utilizes a
talk_fast
function for efficient communication with AI models, supporting both text and image inputs. - Structured AI Responses: Implements a Pydantic model (
AIResponse
) for structured and validated AI responses. - Dynamic API Selection: Allows users to choose between Anthropic and OpenAI APIs at runtime.
The script uses a sophisticated scoring system that considers various factors:
- Match between resume content and job requirements
- Relevance of skills and experience
- Education level
- Years of experience
- Certifications
- Soft skills
- Personal website content (if available)
The AI model analyzes these factors and assigns a score from 0 to 100.
-
Emojis and Labels: Each candidate is assigned an emoji and label based on their score. For example:
ππ 98% - Cosmic Perfection
π¦β¨ 95% - Unicorn Candidate
π π« 93% - Superstar Plus
- ...
βοΈ 10% - Cosmic Mismatch
-
Match Reasons: For candidates scoring above 80%, key reasons for the match are displayed.
-
Website Status:
- Active websites are included in the evaluation.
- Inactive or unreachable websites result in a score penalty and are marked as
(inactive)
.
After processing all resumes, the script provides a summary including:
- Top Score
- Average Score
- Bottom Score
- Number of Processed Resumes
- Number of Errors Encountered (if any)
This summary helps recruiters quickly gauge the overall quality of the candidate pool.
- API Choice: Users can select between Anthropic's Claude API and OpenAI's GPT API at the start of the script.
- Model Customization: Easily switch between different AI models by modifying the
model
parameter in thetalk_fast
function.
- talk_fast Function: A versatile function that handles communication with both Anthropic and OpenAI APIs.
- Support for Text and Image Inputs: Can process both textual and image-based inputs for comprehensive resume analysis.
- Token Management: Automatically manages token limits to ensure optimal use of API context windows.
- Pydantic Models: Utilizes Pydantic for defining structured response types (Score, Reasons, URL, Email).
- Response Validation: Ensures AI responses conform to expected structures, improving reliability and error handling.
- Customizable Criteria: The scoring system uses dynamically weighted criteria that can be adjusted based on job requirements.
- Comprehensive Evaluation: Considers factors such as language proficiency, education, experience, technical skills, certifications, and soft skills.
- Personal Websites: If a personal website URL is found in a resume, the script will:
- Check if the website is active.
- Fetch and include website content in the evaluation.
- Penalize the score if the website is inactive.
- Re-run the matching process with combined resume and website content for a more comprehensive evaluation.
- Logging: Configurable logging levels (
CRITICAL
,ERROR
,WARNING
,INFO
,DEBUG
). - Error Handling: Gracefully handles exceptions without stopping the entire process.
- Generates professional, personalized email responses based on the match score.
- Saves responses in the
out
directory for easy access.
The script provides an engaging user experience with a "resume matching dance" animation displayed in the console during processing. This fun feature uses ASCII art and emojis to show progress and keep users entertained while the script processes resumes.
Modify the logging level at the beginning of the script:
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
Available levels: DEBUG
, INFO
, WARNING
, ERROR
, CRITICAL
.
To change the AI model used, update the model
parameter in the match_resume_to_job
function:
message = client.messages.create(
model="claude-3-5-sonnet-20240620",
...
)
To switch between Anthropic and OpenAI APIs, modify the choose_api
function call at the beginning of the script:
def choose_api():
global chosen_api
prompt = "Use OpenAI API instead of Anthropic? [y/N]: "
choice = input(colored(prompt, "cyan")).strip().lower()
if choice in ["y", "yes"]:
chosen_api = "openai"
else:
chosen_api = "anthropic"
To change the AI model used, update the model
parameter in the talk_fast
function:
response = client.chat.completions.create(
model="gpt-4o", # Change this to the desired model
...
)
The final score for each resume is calculated using a combination of two factors:
-
AI-Generated Match Score (75% weight): This score is based on how well the resume matches the job description, considering factors such as skills, experience, education, and other relevant criteria.
-
Resume Quality Score (25% weight): This score assesses the visual appeal and clarity of the resume itself, including formatting, layout, and overall presentation.
The calculation process is as follows:
- The AI-generated match score and the resume quality score are both normalized to a 0-100 scale.
- A weighted average is calculated:
(AI_Score * 0.75 + Quality_Score * 0.25)
- The result is clamped to ensure it falls within the 0-100 range.
This combined approach ensures that both the content relevance and the presentation quality of the resume are taken into account in the final score.
Adjust the scoring logic in the match_resume_to_job
function's prompt as needed to better fit your specific requirements.
- No Resumes Found: Ensure that resume PDFs are placed in the correct directory (
src
by default). - Job Description Not Found: Confirm that
job_description.txt
exists in the script's directory or provide the correct path. - API Key Errors: Verify that the
CLAUDE_API_KEY
environment variable is set correctly. - Dependency Errors: Install all required Python packages using
pip
.
If you experience network-related errors when fetching personal websites, you may adjust the timeout
parameter in the check_website
function.
response = requests.get(url, timeout=10)
- Data Privacy: Ensure that all candidate data is handled in compliance with relevant data protection laws and regulations.
- API Usage: Be mindful of API rate limits and usage policies when using the Anthropic Claude API.
We welcome contributions! Please follow these steps:
- Fork the Repository: Create your own fork on GitHub.
- Create a Feature Branch: Work on your feature or fix in a new branch.
- Submit a Pull Request: Once your changes are ready, submit a pull request for review.
- Anthropic Claude API: For providing advanced AI capabilities.
Enjoy using the Resume Job Matcher script to streamline your recruitment process!
The following Python packages are required for this project:
- PyPDF2: For extracting text from PDF resumes
- anthropic: To interact with the Anthropic Claude API for AI-powered analysis
- tqdm: For displaying progress bars during processing
- termcolor: To add colored output in the console
- json5: For parsing JSON-like data with added flexibility
- requests: To make HTTP requests for fetching website content
- beautifulsoup4: For parsing HTML content from personal websites
- openai: To interact with the OpenAI API for AI-powered analysis
- pydantic: For data validation and settings management using Python type annotations
To install these packages, you can use pip:
pip install PyPDF2 anthropic openai tqdm termcolor json5 requests beautifulsoup4 pydantic