unitbytes 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
unitbytes/goofish.py ADDED
@@ -0,0 +1,566 @@
1
+ """Goofish / Xianyu (`闲鱼`) C2C marketplace domain namespace (`ub.goofish`) with Standby fast-path and offline slang translation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import asdict, dataclass
6
+ from decimal import Decimal
7
+ import os
8
+ import re
9
+ from typing import TYPE_CHECKING, Any, Literal, Mapping, Sequence
10
+ from urllib.parse import parse_qs, urlparse
11
+
12
+ from ._serialization import filter_unseen_by_key
13
+ from ._transports import unwrap_items_payload, unwrap_object_payload
14
+
15
+ if TYPE_CHECKING:
16
+ from .client import UnitBytes
17
+
18
+ ACTOR_GOOFISH_SEARCH = "unitbytes/goofish-xianyu-search-scraper"
19
+ ACTOR_GOOFISH_SELLER = "unitbytes/goofish-scraper"
20
+ DEFAULT_GOOFISH_STATE_FILE = ".goofish_watchlist_state.json"
21
+
22
+ DetailLevel = Literal["full", "summary"]
23
+ SortOption = Literal[
24
+ "newest", "price_asc", "price_desc", "priceAsc", "priceDesc",
25
+ "priceDrop", "credit", "popularity", "wants", "relevance", "modified",
26
+ ]
27
+ ListingStatus = Literal["all", "onsale", "sold"]
28
+ ReviewFilter = Literal["all", "positive_only", "negative_only", "with_photos"]
29
+ ZhimaTier = Literal["excellent", "very_good", "good", "moderate", "poor", "unrated"]
30
+ RiskLevel = Literal["low", "medium", "elevated", "unknown"]
31
+
32
+ _ALLOWED_GOOFISH_HOSTS = {
33
+ "goofish.com", "www.goofish.com", "h5.m.goofish.com", "market.m.taobao.com",
34
+ "item.taobao.com", "h5.m.taobao.com", "xianyu.taobao.com", "2.taobao.com",
35
+ "s.2.taobao.com", "m.tb.cn",
36
+ }
37
+ _URL_EXTRACT_RE = re.compile(r"(https?://[^\s\"'<>【】]+)", re.IGNORECASE)
38
+ _NUMERIC_ID_RE = re.compile(r"^(\d{6,24})$")
39
+
40
+ GOOFISH_KEYWORD_DICTIONARY: dict[str, str] = {
41
+ "complete in box": "箱说全",
42
+ "box and papers": "箱说全",
43
+ "full set": "箱说全",
44
+ "cib": "箱说全",
45
+ "factory sealed": "全新未拆封",
46
+ "unopened": "全新未拆封",
47
+ "brand new": "全新",
48
+ "sealed": "未拆封",
49
+ "like new": "几乎全新",
50
+ "mint condition": "99新",
51
+ "lightly used": "轻微使用",
52
+ "for parts": "配件机",
53
+ "unrepaired": "无拆无修",
54
+ "personal seller": "个人一手",
55
+ "first owner": "个人一手",
56
+ "inspection passed": "验货宝",
57
+ "free shipping": "包邮",
58
+ "authentic": "正品",
59
+ "china version": "国行",
60
+ "hong kong version": "港版",
61
+ "japanese version": "日版",
62
+ "us version": "美版",
63
+ "unlocked": "无锁",
64
+ "honkai star rail": "崩坏星穹铁道",
65
+ "genshin impact": "原神",
66
+ "blue archive": "蔚蓝档案",
67
+ "arknights": "明日方舟",
68
+ "chiikawa": "吉伊卡哇",
69
+ "pokemon cards": "宝可梦卡牌",
70
+ "pokemon card": "宝可梦卡牌",
71
+ "pokemon": "宝可梦",
72
+ "trading cards": "卡牌",
73
+ "trading card": "卡牌",
74
+ "booster box": "原盒",
75
+ "anime merch": "谷子",
76
+ "anime goods": "谷子",
77
+ "acrylic stand": "立牌",
78
+ "standee": "立牌",
79
+ "cotton doll": "棉花娃娃",
80
+ "plush doll": "棉花娃娃",
81
+ "plushie": "毛绒公仔",
82
+ "plush": "棉花娃娃",
83
+ "tin badge": "吧唧",
84
+ "pin badge": "吧唧",
85
+ "badges": "吧唧",
86
+ "badge": "吧唧",
87
+ "shikishi": "色纸",
88
+ "art board": "色纸",
89
+ "action figure": "可动手办",
90
+ "scale figure": "手办",
91
+ "figurine": "手办",
92
+ "figure": "手办",
93
+ "garage kit": "GK雕像",
94
+ "nendoroid": "粘土人",
95
+ "blind box": "盲盒",
96
+ "keychain": "挂件",
97
+ "tapestry": "挂画",
98
+ "artbook": "设定集",
99
+ "mirrorless camera": "微单相机",
100
+ "mirrorless": "微单",
101
+ "digital camera": "数码相机",
102
+ "point and shoot": "卡片机",
103
+ "compact camera": "卡片机",
104
+ "film camera": "胶片相机",
105
+ "action camera": "运动相机",
106
+ "camera body": "机身",
107
+ "prime lens": "定焦镜头",
108
+ "zoom lens": "变焦镜头",
109
+ "camera lens": "镜头",
110
+ "shutter count": "快门数",
111
+ "fujifilm": "富士",
112
+ "fuji": "富士",
113
+ "hasselblad": "哈苏",
114
+ "insta360": "影石",
115
+ "sony": "索尼",
116
+ "canon": "佳能",
117
+ "nikon": "尼康",
118
+ "leica": "徕卡",
119
+ "ricoh": "理光",
120
+ "sigma": "适马",
121
+ "tamron": "腾龙",
122
+ "gimbal": "稳定器",
123
+ "drone": "无人机",
124
+ "nintendo switch": "任天堂Switch",
125
+ "handheld console": "掌机",
126
+ "handheld": "掌机",
127
+ "graphics card": "显卡",
128
+ "video card": "显卡",
129
+ "gpu": "显卡",
130
+ "motherboard": "主板",
131
+ "processor": "处理器",
132
+ "cpu": "处理器",
133
+ "memory kit": "内存条",
134
+ "ram": "内存条",
135
+ "solid state drive": "固态硬盘",
136
+ "ssd": "固态硬盘",
137
+ "hard drive": "硬盘",
138
+ "power supply": "电源",
139
+ "water cooling": "水冷",
140
+ "mini pc": "迷你主机",
141
+ "gaming laptop": "游戏本",
142
+ "laptop": "笔记本电脑",
143
+ "tablet": "平板电脑",
144
+ "mechanical keyboard": "机械键盘",
145
+ "keycaps": "键帽",
146
+ "gaming mouse": "游戏鼠标",
147
+ "monitor": "显示器",
148
+ "in-ear monitor": "监听耳机",
149
+ "headphones": "头戴式耳机",
150
+ "earbuds": "蓝牙耳机",
151
+ "iem": "有线耳机",
152
+ "dac": "解码耳放",
153
+ "apple": "苹果",
154
+ "road bike": "公路车",
155
+ "mountain bike": "山地车",
156
+ "folding bike": "折叠车",
157
+ "frameset": "车架组",
158
+ "bike frame": "车架",
159
+ "wheelset": "轮组",
160
+ "carbon fiber": "碳纤维",
161
+ "carbon": "碳纤维",
162
+ "groupset": "套件",
163
+ "power meter": "功率计",
164
+ "specialized": "闪电",
165
+ "pinarello": "皮纳瑞罗",
166
+ "cervelo": "梅花",
167
+ "brompton": "小布",
168
+ "giant": "捷安特",
169
+ "trek": "崔克",
170
+ "mechanical watch": "机械表",
171
+ "chronograph": "计时码表",
172
+ "crossbody bag": "斜挎包",
173
+ "shoulder bag": "单肩包",
174
+ "handbag": "手提包",
175
+ "backpack": "双肩包",
176
+ "wallet": "钱包",
177
+ "down jacket": "羽绒服",
178
+ "hardshell": "冲锋衣",
179
+ "fleece": "抓绒衣",
180
+ "sneakers": "运动鞋",
181
+ "denim": "牛仔",
182
+ "vintage": "中古",
183
+ }
184
+
185
+ _COMPILED_GLOSSARY_PATTERNS: list[tuple[re.Pattern[str], str]] = [
186
+ (
187
+ re.compile(rf"(?<![A-Za-z0-9]){re.escape(eng)}(?![A-Za-z0-9])", re.IGNORECASE),
188
+ zh,
189
+ )
190
+ for eng, zh in sorted(GOOFISH_KEYWORD_DICTIONARY.items(), key=lambda kv: len(kv[0]), reverse=True)
191
+ ]
192
+
193
+
194
+ def translate_keyword(
195
+ term: str,
196
+ *,
197
+ custom_glossary: Mapping[str, str] | None = None,
198
+ ) -> str:
199
+ """Translate English product & Xianyu slang terms into Simplified Chinese offline with zero network calls."""
200
+ cleaned = str(term).strip()
201
+ if not cleaned:
202
+ raise ValueError("term cannot be empty.")
203
+ if len(cleaned) > 200:
204
+ cleaned = cleaned[:200].strip()
205
+ cleaned = re.sub(r"\s{2,}", " ", cleaned)
206
+
207
+ patterns = _COMPILED_GLOSSARY_PATTERNS
208
+ if custom_glossary:
209
+ merged = dict(GOOFISH_KEYWORD_DICTIONARY)
210
+ for key, val in custom_glossary.items():
211
+ k = str(key).strip().lower()
212
+ v = str(val).strip()
213
+ if k and v:
214
+ merged[k] = v
215
+ patterns = [
216
+ (re.compile(rf"(?<![A-Za-z0-9]){re.escape(eng)}(?![A-Za-z0-9])", re.IGNORECASE), zh)
217
+ for eng, zh in sorted(merged.items(), key=lambda kv: len(kv[0]), reverse=True)
218
+ ]
219
+
220
+ result = cleaned
221
+ for pattern, zh_term in patterns:
222
+ result = pattern.sub(zh_term, result)
223
+ return re.sub(r"\s+", " ", result).strip()
224
+
225
+
226
+ def _is_allowed_goofish_host(hostname: str) -> bool:
227
+ host = hostname.lower().strip(".")
228
+ return host in _ALLOWED_GOOFISH_HOSTS or host.endswith(".goofish.com") or host.endswith(".tb.cn")
229
+
230
+
231
+ def normalize_seller_target(seller_id_or_url: str | int) -> tuple[str | None, str | None]:
232
+ """Validate a Goofish seller userId, profile/item URL, `fleamarket://` deeplink, or share text."""
233
+ raw = str(seller_id_or_url).strip()
234
+ if not raw:
235
+ raise ValueError("seller_id_or_url cannot be empty.")
236
+ digits = _NUMERIC_ID_RE.match(raw)
237
+ if digits:
238
+ return digits.group(1), None
239
+ if raw.lower().startswith("fleamarket://"):
240
+ if len(raw) > 1024 or any(ord(c) < 32 for c in raw):
241
+ raise ValueError("Invalid fleamarket:// seller deeplink.")
242
+ return None, raw
243
+
244
+ url_match = _URL_EXTRACT_RE.search(raw)
245
+ candidate_url = url_match.group(1) if url_match else raw
246
+ if candidate_url.startswith(("http://", "https://")):
247
+ parsed = urlparse(candidate_url)
248
+ if parsed.username or parsed.password:
249
+ raise ValueError("Goofish seller URL must not contain embedded credentials.")
250
+ host = (parsed.hostname or "").lower()
251
+ if not _is_allowed_goofish_host(host):
252
+ raise ValueError(f"Expected a goofish.com, 2.taobao.com, or m.tb.cn URL, got host {host!r}.")
253
+ qs = parse_qs(parsed.query)
254
+ uid = (qs.get("userId") or qs.get("sellerId") or [None])[0]
255
+ if uid and _NUMERIC_ID_RE.match(uid):
256
+ return uid, candidate_url
257
+ return None, candidate_url
258
+
259
+ if re.match(r"^[A-Za-z0-9+/=_~-]{10,64}$", raw):
260
+ return raw, None
261
+ raise ValueError(f"Invalid Goofish seller target {raw!r}.")
262
+
263
+
264
+ def _extract_item_key(record: Mapping[str, Any]) -> str | None:
265
+ for key in ("id", "itemId", "item_id", "url", "itemUrl"):
266
+ val = record.get(key)
267
+ if val is not None and str(val).strip():
268
+ return str(val).strip()
269
+ return None
270
+
271
+
272
+ def _map_actor_sort(sort_by: str) -> str:
273
+ return {"price_asc": "priceAsc", "price_desc": "priceDesc", "wants": "popularity"}.get(sort_by, sort_by)
274
+
275
+
276
+ def _map_standby_sort(sort_by: str) -> str:
277
+ return {"priceAsc": "price_asc", "priceDesc": "price_desc"}.get(sort_by, sort_by)
278
+
279
+
280
+ @dataclass(frozen=True)
281
+ class SellerTrustAssessment:
282
+ trust_score: int
283
+ zhima_tier: ZhimaTier
284
+ risk_level: RiskLevel
285
+ is_kyc_verified: bool
286
+ sold_count: int
287
+ review_count: int
288
+ signals: list[str]
289
+
290
+ def to_dict(self) -> dict[str, Any]:
291
+ return asdict(self)
292
+
293
+
294
+ def assess_seller_trust(profile_or_item: Mapping[str, Any]) -> SellerTrustAssessment:
295
+ """Evaluate Goofish seller trustworthiness from Zhima Credit (`芝麻信用`), verification badges, and sold history."""
296
+ merged: dict[str, Any] = dict(profile_or_item)
297
+ for nest_k in ("seller", "profile"):
298
+ nested = profile_or_item.get(nest_k)
299
+ if isinstance(nested, Mapping):
300
+ for k, v in nested.items():
301
+ if v is not None and v != "":
302
+ merged[k] = v
303
+
304
+ credit_raw = " ".join(
305
+ str(merged.get(k) or "").strip()
306
+ for k in ("zhimaCreditRating", "sellerCreditRating", "sellerCredit", "zhimaCredit", "creditRating")
307
+ if str(merged.get(k) or "").strip()
308
+ )
309
+ tier: ZhimaTier = "unrated"
310
+ score = 0
311
+ if "极好" in credit_raw:
312
+ tier, score = "excellent", 40
313
+ elif "优秀" in credit_raw:
314
+ tier, score = "very_good", 32
315
+ elif "良好" in credit_raw:
316
+ tier, score = "good", 22
317
+ elif "中等" in credit_raw:
318
+ tier, score = "moderate", 12
319
+ elif "差" in credit_raw:
320
+ tier, score = "poor", 4
321
+
322
+ signals: list[str] = [f"zhima_credit:{tier}"] if tier != "unrated" else []
323
+ real_person = bool(merged.get("isRealPersonVerified"))
324
+ real_name = bool(merged.get("isRealNameVerified")) or bool(merged.get("verified"))
325
+ if real_person:
326
+ score += 18
327
+ signals.append("real_person_biometric_verified")
328
+ elif real_name:
329
+ score += 10
330
+ signals.append("real_name_verified")
331
+
332
+ sold_raw = merged.get("totalSoldCount") or merged.get("soldCount") or merged.get("totalSold") or 0
333
+ sold_count = int(sold_raw) if isinstance(sold_raw, (int, float)) else 0
334
+ if sold_count >= 50:
335
+ score += 16
336
+ elif sold_count >= 10:
337
+ score += 10
338
+ elif sold_count >= 1:
339
+ score += 5
340
+
341
+ rev_raw = merged.get("totalReviews") or merged.get("reviewCount") or 0
342
+ review_count = int(rev_raw) if isinstance(rev_raw, (int, float)) else 0
343
+ if review_count >= 30:
344
+ score += 10
345
+ elif review_count >= 5:
346
+ score += 5
347
+
348
+ clamped = max(0, min(100, score))
349
+ risk: RiskLevel = (
350
+ "unknown"
351
+ if (not credit_raw and not real_person and not real_name and not sold_count and not review_count)
352
+ else ("elevated" if tier == "poor" or clamped < 35 else ("low" if clamped >= 65 else "medium"))
353
+ )
354
+ return SellerTrustAssessment(
355
+ trust_score=clamped,
356
+ zhima_tier=tier,
357
+ risk_level=risk,
358
+ is_kyc_verified=bool(real_person or real_name or tier != "unrated"),
359
+ sold_count=sold_count,
360
+ review_count=review_count,
361
+ signals=signals,
362
+ )
363
+
364
+
365
+ class GoofishNamespace:
366
+ """Goofish / Xianyu (`闲鱼`) search, seller profiles, and offline slang translator (`ub.goofish`)."""
367
+
368
+ def __init__(self, client: UnitBytes) -> None:
369
+ self._client = client
370
+
371
+ def search(
372
+ self,
373
+ keyword: str,
374
+ *,
375
+ max_items: int = 20,
376
+ page: int = 1,
377
+ detail_level: DetailLevel = "full",
378
+ sort_by: SortOption = "newest",
379
+ price_min: float | None = None,
380
+ price_max: float | None = None,
381
+ personal_only: bool = False,
382
+ free_shipping: bool = False,
383
+ quick_filters: Sequence[str] | None = None,
384
+ region_ids: Sequence[str] | None = None,
385
+ translate_keywords: bool = False,
386
+ only_new: bool = False,
387
+ state_file: str | os.PathLike[str] | None = None,
388
+ prefer_standby: bool | None = None,
389
+ fallback_to_batch: bool = True,
390
+ no_cache: bool = False,
391
+ max_total_charge_usd: float | Decimal | None = None,
392
+ ) -> list[dict[str, Any]]:
393
+ """Search Goofish / Xianyu (`闲鱼`) listings with optional Standby fast-path (`prefer_standby=True`) and offline translation."""
394
+ cleaned_kw = str(keyword or "").strip()
395
+ if not cleaned_kw:
396
+ raise ValueError("keyword cannot be empty.")
397
+ if int(max_items) < 1:
398
+ raise ValueError(f"max_items must be >= 1, got {max_items}.")
399
+
400
+ effective_kw = translate_keyword(cleaned_kw) if translate_keywords else cleaned_kw
401
+ q_filters = [f.strip() for f in (quick_filters or []) if f and str(f).strip()]
402
+ regions = [r.strip() for r in (region_ids or []) if r and str(r).strip()]
403
+
404
+ merged_filters = list(q_filters)
405
+ if personal_only and "filterPersonal" not in merged_filters:
406
+ merged_filters.append("filterPersonal")
407
+ if free_shipping and "filterFreePostage" not in merged_filters:
408
+ merged_filters.append("filterFreePostage")
409
+
410
+ actor_input: dict[str, Any] = {
411
+ "keyword": effective_kw,
412
+ "maxItems": max(1, min(1500, int(max_items))),
413
+ "detailLevel": detail_level,
414
+ "sortBy": _map_actor_sort(sort_by),
415
+ }
416
+ if price_min is not None:
417
+ actor_input["priceMin"] = int(price_min)
418
+ if price_max is not None:
419
+ actor_input["priceMax"] = int(price_max)
420
+ if merged_filters:
421
+ actor_input["quickFilters"] = merged_filters
422
+ if regions:
423
+ actor_input["regionIds"] = regions
424
+
425
+ standby_params: dict[str, Any] = {
426
+ "keyword": effective_kw,
427
+ "page": int(page),
428
+ "page_size": min(30, int(max_items)),
429
+ "sort_by": _map_standby_sort(sort_by),
430
+ "price_min": price_min,
431
+ "price_max": price_max,
432
+ "personal_only": personal_only or None,
433
+ "free_shipping": free_shipping or None,
434
+ "quick_filters": ",".join(q_filters) if q_filters else None,
435
+ "region_ids": ",".join(regions) if regions else None,
436
+ "detail_level": detail_level,
437
+ "no_cache": no_cache or None,
438
+ }
439
+
440
+ brand_new = any(f in {"filterNew", "brand_new"} for f in q_filters)
441
+ inspected = any(f in {"filterInspected", "inspected_only"} for f in q_filters)
442
+ rest_params: dict[str, Any] = {
443
+ "keyword": effective_kw,
444
+ "page": int(page),
445
+ "page_size": min(30, int(max_items)),
446
+ "sort_by": _map_actor_sort(sort_by),
447
+ "price_min": price_min,
448
+ "price_max": price_max,
449
+ "personal_only": personal_only or None,
450
+ "free_shipping": free_shipping or None,
451
+ "brand_new": brand_new or None,
452
+ "inspected_only": inspected or None,
453
+ "region": ",".join(regions) if regions else None,
454
+ "no_cache": no_cache or None,
455
+ }
456
+
457
+ raw = self._client._transport.execute_operation(
458
+ service="goofish",
459
+ operation="search",
460
+ actor_slug=ACTOR_GOOFISH_SEARCH,
461
+ actor_input=actor_input,
462
+ http_method="GET",
463
+ params=rest_params,
464
+ standby_path="/v1/search",
465
+ standby_params=standby_params,
466
+ prefer_standby=prefer_standby,
467
+ fallback_to_batch=fallback_to_batch,
468
+ max_total_charge_usd=max_total_charge_usd,
469
+ )
470
+ results = [r for r in unwrap_items_payload(raw) if not r.get("error")][: int(max_items)]
471
+ if only_new:
472
+ results = filter_unseen_by_key(
473
+ results,
474
+ key_fn=_extract_item_key,
475
+ state_file=state_file or DEFAULT_GOOFISH_STATE_FILE,
476
+ max_return=int(max_items),
477
+ )
478
+ return results
479
+
480
+ def seller(
481
+ self,
482
+ seller_id_or_url: str | int,
483
+ *,
484
+ include_items: bool = True,
485
+ max_items: int = 20,
486
+ include_reviews: bool = False,
487
+ max_reviews: int = 20,
488
+ status_filter: ListingStatus = "all",
489
+ review_filter: ReviewFilter = "all",
490
+ detail_level: DetailLevel = "full",
491
+ prefer_standby: bool | None = None,
492
+ fallback_to_batch: bool = True,
493
+ no_cache: bool = False,
494
+ max_total_charge_usd: float | Decimal | None = None,
495
+ ) -> dict[str, Any]:
496
+ """Fetch Goofish seller Zhima Credit rating, KYC badges, listings, and buyer reviews."""
497
+ seller_id, seller_url = normalize_seller_target(seller_id_or_url)
498
+ target_str = seller_url or str(seller_id)
499
+
500
+ actor_input: dict[str, Any] = {
501
+ "mode": "seller",
502
+ "sellerInputs": [target_str],
503
+ "includeListings": bool(include_items),
504
+ "includeReviews": bool(include_reviews),
505
+ "maxListings": int(max_items) if include_items else 0,
506
+ "maxReviews": int(max_reviews) if include_reviews else 0,
507
+ "statusFilter": status_filter,
508
+ "reviewFilter": review_filter,
509
+ "outputFormat": "nested",
510
+ "detailLevel": detail_level,
511
+ }
512
+
513
+ standby_params: dict[str, Any] = {
514
+ "seller_id": seller_id,
515
+ "url": seller_url if not seller_id else None,
516
+ "include_items": include_items or None,
517
+ "max_items": min(20, int(max_items)) if include_items else None,
518
+ "include_reviews": include_reviews or None,
519
+ "max_reviews": min(20, int(max_reviews)) if include_reviews else None,
520
+ "detail_level": detail_level,
521
+ "no_cache": no_cache or None,
522
+ }
523
+
524
+ rest_params: dict[str, Any] = {
525
+ "seller_id": seller_id,
526
+ "url": seller_url if not seller_id else None,
527
+ "include_items": include_items or None,
528
+ "max_items": min(20, int(max_items)) if include_items else None,
529
+ "include_reviews": include_reviews or None,
530
+ "max_reviews": min(20, int(max_reviews)) if include_reviews else None,
531
+ "no_cache": no_cache or None,
532
+ }
533
+
534
+ raw = self._client._transport.execute_operation(
535
+ service="goofish",
536
+ operation="seller",
537
+ actor_slug=ACTOR_GOOFISH_SELLER,
538
+ actor_input=actor_input,
539
+ http_method="GET",
540
+ params=rest_params,
541
+ standby_path="/v1/seller",
542
+ standby_params=standby_params,
543
+ prefer_standby=prefer_standby,
544
+ fallback_to_batch=fallback_to_batch,
545
+ max_total_charge_usd=max_total_charge_usd,
546
+ )
547
+ return unwrap_object_payload(raw)
548
+
549
+ @staticmethod
550
+ def translate_keyword(
551
+ term: str,
552
+ *,
553
+ custom_glossary: Mapping[str, str] | None = None,
554
+ ) -> str:
555
+ """Translate English product & Xianyu slang terms into Simplified Chinese offline (`0` network calls)."""
556
+ return translate_keyword(term, custom_glossary=custom_glossary)
557
+
558
+
559
+ __all__ = [
560
+ "GoofishNamespace",
561
+ "GOOFISH_KEYWORD_DICTIONARY",
562
+ "SellerTrustAssessment",
563
+ "assess_seller_trust",
564
+ "normalize_seller_target",
565
+ "translate_keyword",
566
+ ]