落地多段联运私聊:齐了才建单拉群,附件只收格子值,核对改正不再整单重开。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -174,11 +174,35 @@ _GENERIC_KEYWORDS = frozenset(
|
||||
{"海运", "空运", "陆运", "sea", "air", "land", "国内"}
|
||||
)
|
||||
|
||||
# 后台陆运模板常用「国内拼车」,询价字段是「国内运输拼车」,不能当两回事。
|
||||
_LAND_KEYWORD_ALIASES = {
|
||||
"国内拼车": ("国内运输拼车", "拼车"),
|
||||
"国内零担": ("国内运输拼车", "国内长途/零担", "零担"),
|
||||
"国内整车": ("国内运输整车", "整车"),
|
||||
"跨境整车": ("跨境整车",),
|
||||
"跨境集拼": ("跨境集拼",),
|
||||
"跨境零担": ("跨境集拼",),
|
||||
}
|
||||
|
||||
|
||||
def _keyword_needles(kw: str) -> list[str]:
|
||||
"""关键词本身 + 陆运别名,都小写。"""
|
||||
raw = (kw or "").strip()
|
||||
if not raw:
|
||||
return []
|
||||
out = [raw.lower()]
|
||||
for alias in _LAND_KEYWORD_ALIASES.get(raw, ()):
|
||||
token = alias.lower()
|
||||
if token not in out:
|
||||
out.append(token)
|
||||
return out
|
||||
|
||||
|
||||
def _keyword_score(raw: Any, haystack: str, type_val: str) -> tuple[int, int]:
|
||||
"""
|
||||
运输类型上的命中优先,其次全文词长。
|
||||
「陆运/国内」跳过,避免中港、国内整车抢走拼车单。
|
||||
「国内拼车」要对上「国内运输拼车」。
|
||||
"""
|
||||
type_hits = 0
|
||||
length = 0
|
||||
@@ -187,11 +211,12 @@ def _keyword_score(raw: Any, haystack: str, type_val: str) -> tuple[int, int]:
|
||||
k = kw.lower()
|
||||
if k in _GENERIC_KEYWORDS:
|
||||
continue
|
||||
if type_val and k in type_val:
|
||||
needles = _keyword_needles(kw)
|
||||
if type_val and any(n in type_val for n in needles):
|
||||
type_hits += 1
|
||||
length += len(k)
|
||||
any_hit = True
|
||||
elif k in haystack:
|
||||
elif any(n in haystack for n in needles):
|
||||
length += len(k)
|
||||
any_hit = True
|
||||
if not any_hit:
|
||||
|
||||
Reference in New Issue
Block a user