fix: prioritize media URL classification
This commit is contained in:
@@ -41,12 +41,14 @@ def _kind(url: str, label: str | None, context: str) -> str:
|
||||
value = f"{label or ''} {context}".casefold()
|
||||
if "/flags/" in path or "/themes/" in path or path.endswith(("/logo.png", "/logo.svg")):
|
||||
return "reference"
|
||||
# A structural tackle path is stronger evidence than words in a product
|
||||
# name (for example, bait named "Краб и рыба").
|
||||
if re.search(r"(?:^|[/_-])(?:bait|lure|rig|rod|reel|hook|tackle|köder|rute|rolle)(?:[/_.-]|$)", path):
|
||||
return "tackle"
|
||||
if re.search(r"/(?:fish|fishes|fische|species)/", path) or re.search(r"/(?:fish|species)[_-]", path) or "/media/fische/" in value or any(word in value for word in ("рыба ", "fish: ", "fisch: ")):
|
||||
return "fish"
|
||||
if re.search(r"/(?:maps?|levels?|lakes?|waterbodies)/", path) or "/media/levels/" in value or any(word in value for word in ("карта ", "map of ", "gewässerkarte")):
|
||||
return "waterbody"
|
||||
if re.search(r"(?:^|[/_-])(?:bait|lure|rig|rod|reel|hook|tackle|köder|rute|rolle)(?:[/_.-]|$)", path):
|
||||
return "tackle"
|
||||
return "reference"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user