Skip to content

Location Analyzer

LocationAnalyzer

LocationAnalyzer(semantic_matcher=None)

Analyzer for location matching between resume and job.

Matches resume location against job location using: 1. Substring matching (e.g., "San Francisco" matches "San Francisco, CA") 2. Semantic similarity (if semantic_matcher provided)

Attributes:

Name Type Description
semantic_matcher

Optional semantic matcher for location matching.

Example
analyzer = LocationAnalyzer(semantic_matcher=matcher)
score = analyzer.analyze("San Francisco, CA", "San Francisco")

Initialize the location analyzer.

Parameters:

Name Type Description Default
semantic_matcher SemanticMatcher | None

Optional semantic matcher for location matching.

None
Source code in at_scorer/analyzers/location.py
def __init__(self, semantic_matcher: SemanticMatcher | None = None):
    """Initialize the location analyzer.

    Args:
        semantic_matcher: Optional semantic matcher for location matching.
    """
    self.semantic_matcher = semantic_matcher

Functions

analyze
analyze(resume_location, job_location)

Analyze location matching between resume and job.

Parameters:

Name Type Description Default
resume_location str | None

Location from resume (e.g., "San Francisco, CA").

required
job_location str | None

Job location requirement.

required

Returns:

Type Description
float

Score between 0.0 and 1.0: - 1.0 if locations match or one contains the other - 0.0 if no match or missing locations - Semantic similarity score if semantic_matcher available

Source code in at_scorer/analyzers/location.py
def analyze(self, resume_location: str | None, job_location: str | None) -> float:
    """Analyze location matching between resume and job.

    Args:
        resume_location: Location from resume (e.g., "San Francisco, CA").
        job_location: Job location requirement.

    Returns:
        Score between 0.0 and 1.0:
            - 1.0 if locations match or one contains the other
            - 0.0 if no match or missing locations
            - Semantic similarity score if semantic_matcher available
    """
    if not job_location:
        return 1.0
    if not resume_location:
        return 0.0
    resume_norm = normalize_text(resume_location)
    job_norm = normalize_text(job_location)
    if not resume_norm or not job_norm:
        return 0.0
    if job_norm in resume_norm or resume_norm in job_norm:
        return 1.0
    if self.semantic_matcher:
        return self.semantic_matcher.similarity(resume_norm, job_norm)
    return 0.0