Skip to content

The job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.

fix(salary): stop dropping the dotted A.M.B.A. suffix in company-name matching (#356)

Ritik Yadav7d00ec7925b4
diff --git a/salary_lookup.py b/salary_lookup.py
index 80209352..4d1bbcbd 100644
--- a/salary_lookup.py
+++ b/salary_lookup.py
@@ -35,7 +35,7 @@ SPELLING_VARIANTS = {
# Legal suffixes and noise to strip when matching company names
STRIP_PATTERNS = [
r"\ba/s\b", r"\baps\b", r"\bi/s\b", r"\bp/s\b", r"\bk/s\b",
- r"\bivs\b", r"\bamba\b", r"\ba\.m\.b\.a\.\b",
+ r"\bivs\b", r"\bamba\b", r"\ba\.m\.b\.a\.?\b",
r"\(vg\)", r"\(.*?\)", # (VG) and other parentheticals
r"\bdanmark\b", r"\bdenmark\b", r"\bscandinavia\b", r"\bnordic\b",
r"\bgroup\b", r"\bholding\b",
diff --git a/tests/test_salary_lookup.py b/tests/test_salary_lookup.py
index 0a4dd066..77f4de94 100644
--- a/tests/test_salary_lookup.py
+++ b/tests/test_salary_lookup.py
@@ -102,6 +102,12 @@ class TestMatchScoreExactMatch(unittest.TestCase):
def test_exact_match_after_suffix_stripping(self):
self.assertEqual(match_score("Mærsk", "Mærsk A/S"), 100)
+ def test_exact_match_after_dotted_amba_suffix_stripping(self):
+ # "A.M.B.A." (dotted) is the same legal-suffix family as the
+ # undotted "amba" pattern above it in STRIP_PATTERNS and must
+ # strip just as cleanly.
+ self.assertEqual(match_score("Arla Foods", "Arla Foods A.M.B.A."), 100)
+
class TestMatchScoreSubstring(unittest.TestCase):
def test_query_contained_in_entry_gives_high_score(self):
@@ -332,6 +338,14 @@ class UtilityTests(unittest.TestCase):
self.assertEqual(normalize("Chr. Hansen, Denmark Division"), "chrhansen")
self.assertEqual(normalize("Simple Corp ApS"), "simplecorp")
+ def test_normalize_strips_dotted_amba_suffix_same_as_undotted(self):
+ # The dotted form ("A.M.B.A.") must normalize identically to the
+ # undotted form ("amba"), same as A/S vs ApS variants above.
+ self.assertEqual(
+ normalize("Arla Foods A.M.B.A."), normalize("Arla Foods amba")
+ )
+ self.assertEqual(normalize("Arla Foods A.M.B.A."), "arlafoods")
+
def test_anglicize_replaces_danish_chars(self):
self.assertEqual(anglicize("ørsted"), "orsted")
self.assertEqual(anglicize("mærsk"), "maersk")