fix(salary): match thorn and eth in Nordic ASCII spellings (#720)

* fix(salary): match thorn and eth in Nordic ASCII spellings

* docs: reference PR 720 in changelog

---------

Co-authored-by: Mads Lorentzen <madslorentzen17@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-11-10 19:54:08 +01:00
1 parent 5612dd619b
commit c75041c012
2 files changed
+18 -1

No files matched your search

+2 -1
View File
@@ -27,10 +27,11 @@ from pathlib import Path
DATA_FILE = Path(__file__).parent / "salary_data.json"
# Common Danish <-> anglicized spelling variants
# Common Nordic <-> anglicized spelling variants
SPELLING_VARIANTS = {
"ø": "o", "æ": "ae", "å": "aa",
"ö": "o", "ä": "ae", "ü": "u",
"þ": "th", "ð": "d",
}
# Legal suffixes and noise to strip when matching company names
+16
View File
@@ -22,6 +22,7 @@ class UnicodeSalaryCLI(unittest.TestCase):
names = [
"腾讯", "東京 AI", "北京 AI", "Acme Corp", "Café Étoile",
"Nestlé Danmark A/S", "Ørsted A/S", "Mærsk A/S", "Åland A/S",
"Þekkingarmiðlun ehf.",
]
data = {"companies": [
{"company": name, "categories": {"all_employees": {"index": 105}}}
@@ -60,3 +61,18 @@ class UnicodeSalaryCLI(unittest.TestCase):
("Aaland", "Åland A/S")]:
with self.subTest(query=query):
self.assertEqual(self.lookup(query), [expected])
def test_official_ascii_and_native_nordic_company_spellings_match(self):
# The company uses Þekkingarmiðlun and thekkingarmidlun.is publicly.
# As in the other cases, the index is synthetic, not its salary data.
for query in ("Thekkingarmidlun", "THEKKINGARMIDLUN", "Þekkingarmiðlun", "ÞEKKINGARMIÐLUN"):
with self.subTest(query=query):
self.assertEqual(self.lookup(query), ["Þekkingarmiðlun ehf."])
def test_native_nordic_query_finds_ascii_company_data(self):
(self.root / "salary_data.json").write_text(json.dumps({"companies": [
{"company": "Thekkingarmidlun", "categories": {"all_employees": {"index": 105}}},
]}), encoding="utf-8")
for query in ("Þekkingarmiðlun", "ÞEKKINGARMIÐLUN"):
with self.subTest(query=query):
self.assertEqual(self.lookup(query), ["Thekkingarmidlun"])