Blame view

indexer/product_enrich_prompts.py 17.1 KB
a73a751f   tangwang   enrich
1
2
3
4
5
6
7
8
9
10
  #!/usr/bin/env python3
  
  from typing import Any, Dict
  
  SYSTEM_MESSAGE = (
      "You are an e-commerce product annotator. "
      "Continue the provided assistant Markdown table prefix. "
      "Do not repeat or modify the prefix, and do not add explanations outside the table."
  )
  
a47416ec   tangwang   把融合逻辑改成乘法公式,并把 ES...
11
  SHARED_ANALYSIS_INSTRUCTION = """Analyze each input product text and fill these columns:
a73a751f   tangwang   enrich
12
  
e50924ed   tangwang   1. tags -> enrich...
13
14
15
16
17
18
19
20
21
22
  1. Product title: a natural, localized product name based on the input text
  2. Category path: a concise category hierarchy from broad to specific, separated by ">"
  3. Fine-grained tags: concise tags for style, features, design details, function, or standout selling points
  4. Target audience: gender, age group, body type, or suitable users when clearly implied
  5. Usage scene: likely occasions, settings, or use cases
  6. Applicable season: relevant season(s) based on the product text
  7. Key attributes: core product attributes and specifications. Depending on the item type, this may include fit, silhouette, length, sleeve type, neckline, waistline, closure, pattern, design details, structure, or other relevant attribute dimensions
  8. Material description: material, fabric, texture, or construction description
  9. Functional features: practical or performance-related functions such as stretch, breathability, warmth, support, storage, protection, or ease of wear
  10. Anchor text: a search-oriented keyword string covering product type, category intent, attributes, design cues, usage scenarios, and strong shopping phrases
a73a751f   tangwang   enrich
23
24
25
  
  Rules:
  - Keep the input order and row count exactly the same.
a47416ec   tangwang   把融合逻辑改成乘法公式,并把 ES...
26
  - Infer only from the provided input product text; if uncertain, prefer concise and broadly correct ecommerce wording.
a73a751f   tangwang   enrich
27
28
29
30
31
32
33
34
35
  - Keep category paths concise and use ">" as the separator.
  - For columns with multiple values, the localized output requirement will define the delimiter.
  
  Input product list:
  """
  
  USER_INSTRUCTION_TEMPLATE = """Please strictly return a Markdown table following the given columns in the specified language. For any column containing multiple values, separate them with commas. Do not add any other explanation.
  Language: {language}"""
  
36516857   tangwang   feat(product_enri...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  TAXONOMY_SHARED_ANALYSIS_INSTRUCTION = """Analyze each input product text and fill the columns below using an apparel attribute taxonomy.
  
  Output columns:
  1. Product Type: concise ecommerce apparel category label, not a full marketing title
  2. Target Gender: intended gender only if clearly implied
  3. Age Group: only if clearly implied, e.g. adults, kids, teens, toddlers, babies
  4. Season: season(s) or all-season suitability only if supported
  5. Fit: body closeness, e.g. slim, regular, relaxed, oversized, fitted
  6. Silhouette: overall garment shape, e.g. straight, A-line, boxy, tapered, bodycon, wide-leg
  7. Neckline: neckline type when applicable, e.g. crew neck, V-neck, hooded, collared, square neck
  8. Sleeve Length Type: sleeve length only, e.g. sleeveless, short sleeve, long sleeve, three-quarter sleeve
  9. Sleeve Style: sleeve design only, e.g. puff sleeve, raglan sleeve, batwing sleeve, bell sleeve
  10. Strap Type: strap design when applicable, e.g. spaghetti strap, wide strap, halter strap, adjustable strap
  11. Rise / Waistline: waist placement when applicable, e.g. high rise, mid rise, low rise, empire waist
  12. Leg Shape: for bottoms only, e.g. straight leg, wide leg, flare leg, tapered leg, skinny leg
  13. Skirt Shape: for skirts only, e.g. A-line, pleated, pencil, mermaid
  14. Length Type: design length only, not size, e.g. cropped, regular, longline, mini, midi, maxi, ankle length, full length
  15. Closure Type: fastening method when applicable, e.g. zipper, button, drawstring, elastic waist, hook-and-loop
  16. Design Details: construction or visual details, e.g. ruched, ruffled, pleated, cut-out, layered, distressed, split hem
  17. Fabric: fabric type only, e.g. denim, knit, chiffon, jersey, fleece, cotton twill
  18. Material Composition: fiber content or blend only if stated, e.g. cotton, polyester, spandex, linen blend, 95% cotton 5% elastane
  19. Fabric Properties: inherent fabric traits, e.g. stretch, breathable, lightweight, soft-touch, water-resistant
  20. Clothing Features: product features, e.g. lined, reversible, hooded, packable, padded, pocketed
  21. Functional Benefits: wearer benefits, e.g. moisture-wicking, thermal insulation, UV protection, easy care, supportive compression
  22. Color: specific color name when available
  23. Color Family: normalized broad retail color group, e.g. black, white, blue, green, red, pink, beige, brown, gray
  24. Print / Pattern: surface pattern when applicable, e.g. solid, striped, plaid, floral, graphic, animal print
  25. Occasion / End Use: likely use occasion only if supported, e.g. office, casual wear, streetwear, lounge, workout, outdoor
  26. Style Aesthetic: overall style only if supported, e.g. minimalist, streetwear, athleisure, smart casual, romantic, playful
  
  Rules:
  - Keep the same row order and row count as input.
  - Infer only from the provided product text.
  - Leave blank if not applicable or not reasonably supported.
  - Use concise, standardized ecommerce wording.
  - Do not combine different attribute dimensions in one field.
  - If multiple values are needed, use the delimiter required by the localization setting.
  
  Input product list:
  """
  
  TAXONOMY_MARKDOWN_TABLE_HEADERS_EN = [
    "No.",
    "Product Type",
    "Target Gender",
    "Age Group",
    "Season",
    "Fit",
    "Silhouette",
    "Neckline",
    "Sleeve Length Type",
    "Sleeve Style",
    "Strap Type",
    "Rise / Waistline",
    "Leg Shape",
    "Skirt Shape",
    "Length Type",
    "Closure Type",
    "Design Details",
    "Fabric",
    "Material Composition",
    "Fabric Properties",
    "Clothing Features",
    "Functional Benefits",
    "Color",
    "Color Family",
    "Print / Pattern",
    "Occasion / End Use",
    "Style Aesthetic",
  ]
  
  TAXONOMY_LANGUAGE_MARKDOWN_TABLE_HEADERS: Dict[str, Dict[str, Any]] = {
    "en": TAXONOMY_MARKDOWN_TABLE_HEADERS_EN,
    "zh": [
      "序号",
      "品类",
      "目标性别",
      "年龄段",
      "适用季节",
      "版型",
      "廓形",
      "领型",
      "袖长类型",
      "袖型",
      "肩带设计",
      "腰型",
      "裤型",
      "裙型",
      "长度类型",
      "闭合方式",
      "设计细节",
      "面料",
      "成分",
      "面料特性",
      "服装特征",
      "功能",
      "主颜色",
      "色系",
      "印花 / 图案",
      "适用场景",
      "风格",
    ],
  }
  
a73a751f   tangwang   enrich
140
141
142
143
144
145
146
147
148
149
150
151
  LANGUAGE_MARKDOWN_TABLE_HEADERS: Dict[str, Dict[str, Any]] = {
    "en": [
      "No.",
      "Product title",
      "Category path",
      "Fine-grained tags",
      "Target audience",
      "Usage scene",
      "Season",
      "Key attributes",
      "Material",
      "Features",
a73a751f   tangwang   enrich
152
153
154
155
156
157
158
159
160
161
162
163
164
      "Anchor text"
    ],
    "zh": [
      "序号",
      "商品标题",
      "品类路径",
      "细分标签",
      "适用人群",
      "使用场景",
      "适用季节",
      "关键属性",
      "材质说明",
      "功能特点",
a73a751f   tangwang   enrich
165
166
167
168
169
170
171
172
173
174
175
176
177
      "锚文本"
    ],
    "zh_tw": [
      "序號",
      "商品標題",
      "品類路徑",
      "細分標籤",
      "適用人群",
      "使用場景",
      "適用季節",
      "關鍵屬性",
      "材質說明",
      "功能特點",
a73a751f   tangwang   enrich
178
179
180
181
182
183
184
185
186
187
188
189
190
      "錨文本"
    ],
    "ru": [
      "№",
      "Название товара",
      "Путь категории",
      "Детализированные теги",
      "Целевая аудитория",
      "Сценарий использования",
      "Сезон",
      "Ключевые атрибуты",
      "Материал",
      "Особенности",
a73a751f   tangwang   enrich
191
192
193
194
195
196
197
198
199
200
201
202
203
      "Анкорный текст"
    ],
    "ja": [
      "番号",
      "商品タイトル",
      "カテゴリパス",
      "詳細タグ",
      "対象ユーザー",
      "利用シーン",
      "季節",
      "主要属性",
      "素材",
      "機能特徴",
a73a751f   tangwang   enrich
204
205
206
207
208
209
210
211
212
213
214
215
216
      "アンカーテキスト"
    ],
    "ko": [
      "번호",
      "상품 제목",
      "카테고리 경로",
      "세부 태그",
      "대상 고객",
      "사용 장면",
      "계절",
      "핵심 속성",
      "소재",
      "기능 특징",
a73a751f   tangwang   enrich
217
218
219
220
221
222
223
224
225
226
227
228
229
      "앵커 텍스트"
    ],
    "es": [
      "N.º",
      "Titulo del producto",
      "Ruta de categoria",
      "Etiquetas detalladas",
      "Publico objetivo",
      "Escenario de uso",
      "Temporada",
      "Atributos clave",
      "Material",
      "Caracteristicas",
a73a751f   tangwang   enrich
230
231
232
233
234
235
236
237
238
239
240
241
242
      "Texto ancla"
    ],
    "fr": [
      "N°",
      "Titre du produit",
      "Chemin de categorie",
      "Etiquettes detaillees",
      "Public cible",
      "Scenario d'utilisation",
      "Saison",
      "Attributs cles",
      "Matiere",
      "Caracteristiques",
a73a751f   tangwang   enrich
243
244
245
246
247
248
249
250
251
252
253
254
255
      "Texte d'ancrage"
    ],
    "pt": [
      "Nº",
      "Titulo do produto",
      "Caminho da categoria",
      "Tags detalhadas",
      "Publico-alvo",
      "Cenario de uso",
      "Estacao",
      "Atributos principais",
      "Material",
      "Caracteristicas",
a73a751f   tangwang   enrich
256
257
258
259
260
261
262
263
264
265
266
267
268
      "Texto ancora"
    ],
    "de": [
      "Nr.",
      "Produkttitel",
      "Kategoriepfad",
      "Detaillierte Tags",
      "Zielgruppe",
      "Nutzungsszenario",
      "Saison",
      "Wichtige Attribute",
      "Material",
      "Funktionen",
a73a751f   tangwang   enrich
269
270
271
272
273
274
275
276
277
278
279
280
281
      "Ankertext"
    ],
    "it": [
      "N.",
      "Titolo del prodotto",
      "Percorso categoria",
      "Tag dettagliati",
      "Pubblico target",
      "Scenario d'uso",
      "Stagione",
      "Attributi chiave",
      "Materiale",
      "Caratteristiche",
a73a751f   tangwang   enrich
282
283
284
285
286
287
288
289
290
291
292
293
294
      "Testo ancora"
    ],
    "th": [
      "ลำดับ",
      "ชื่อสินค้า",
      "เส้นทางหมวดหมู่",
      "แท็กย่อย",
      "กลุ่มเป้าหมาย",
      "สถานการณ์การใช้งาน",
      "ฤดูกาล",
      "คุณสมบัติสำคัญ",
      "วัสดุ",
      "คุณสมบัติการใช้งาน",
a73a751f   tangwang   enrich
295
296
297
298
299
300
301
302
303
304
305
306
307
      "แองเคอร์เท็กซ์"
    ],
    "vi": [
      "STT",
      "Tieu de san pham",
      "Duong dan danh muc",
      "The chi tiet",
      "Doi tuong phu hop",
      "Boi canh su dung",
      "Mua phu hop",
      "Thuoc tinh chinh",
      "Chat lieu",
      "Tinh nang",
a73a751f   tangwang   enrich
308
309
310
311
312
313
314
315
316
317
318
319
320
      "Van ban neo"
    ],
    "id": [
      "No.",
      "Judul produk",
      "Jalur kategori",
      "Tag terperinci",
      "Target pengguna",
      "Skenario penggunaan",
      "Musim",
      "Atribut utama",
      "Bahan",
      "Fitur",
a73a751f   tangwang   enrich
321
322
323
324
325
326
327
328
329
330
331
332
333
      "Teks jangkar"
    ],
    "ms": [
      "No.",
      "Tajuk produk",
      "Laluan kategori",
      "Tag terperinci",
      "Sasaran pengguna",
      "Senario penggunaan",
      "Musim",
      "Atribut utama",
      "Bahan",
      "Ciri-ciri",
a73a751f   tangwang   enrich
334
335
336
337
338
339
340
341
342
343
344
345
346
      "Teks sauh"
    ],
    "ar": [
      "الرقم",
      "عنوان المنتج",
      "مسار الفئة",
      "الوسوم التفصيلية",
      "الفئة المستهدفة",
      "سيناريو الاستخدام",
      "الموسم",
      "السمات الرئيسية",
      "المادة",
      "الميزات",
a73a751f   tangwang   enrich
347
348
349
350
351
352
353
354
355
356
357
358
359
      "نص الربط"
    ],
    "hi": [
      "क्रमांक",
      "उत्पाद शीर्षक",
      "श्रेणी पथ",
      "विस्तृत टैग",
      "लक्षित उपभोक्ता",
      "उपयोग परिदृश्य",
      "मौसम",
      "मुख्य गुण",
      "सामग्री",
      "विशेषताएं",
a73a751f   tangwang   enrich
360
361
362
363
364
365
366
367
368
369
370
371
372
      "एंकर टेक्स्ट"
    ],
    "he": [
      "מס׳",
      "כותרת המוצר",
      "נתיב קטגוריה",
      "תגיות מפורטות",
      "קהל יעד",
      "תרחיש שימוש",
      "עונה",
      "מאפיינים מרכזיים",
      "חומר",
      "תכונות",
a73a751f   tangwang   enrich
373
374
375
376
377
378
379
380
381
382
383
384
385
      "טקסט עוגן"
    ],
    "my": [
      "အမှတ်စဉ်",
      "ကုန်ပစ္စည်းခေါင်းစဉ်",
      "အမျိုးအစားလမ်းကြောင်း",
      "အသေးစိတ်တဂ်များ",
      "ပစ်မှတ်အသုံးပြုသူ",
      "အသုံးပြုမှုအခြေအနေ",
      "ရာသီ",
      "အဓိကဂုဏ်သတ္တိများ",
      "ပစ္စည်း",
      "လုပ်ဆောင်ချက်များ",
a73a751f   tangwang   enrich
386
387
388
389
390
391
392
393
394
395
396
397
398
      "အန်ကာစာသား"
    ],
    "ta": [
      "எண்",
      "தயாரிப்பு தலைப்பு",
      "வகை பாதை",
      "விரிவான குறிச்சொற்கள்",
      "இலக்கு பயனர்கள்",
      "பயன்பாட்டு நிலை",
      "பருவம்",
      "முக்கிய பண்புகள்",
      "பொருள்",
      "அம்சங்கள்",
a73a751f   tangwang   enrich
399
400
401
402
403
404
405
406
407
408
409
410
411
      "ஆங்கர் உரை"
    ],
    "ur": [
      "نمبر",
      "پروڈکٹ عنوان",
      "زمرہ راستہ",
      "تفصیلی ٹیگز",
      "ہدف صارفین",
      "استعمال کا منظر",
      "موسم",
      "کلیدی خصوصیات",
      "مواد",
      "فیچرز",
a73a751f   tangwang   enrich
412
413
414
415
416
417
418
419
420
421
422
423
424
      "اینکر ٹیکسٹ"
    ],
    "bn": [
      "ক্রম",
      "পণ্যের শিরোনাম",
      "শ্রেণি পথ",
      "বিস্তারিত ট্যাগ",
      "লক্ষ্য ব্যবহারকারী",
      "ব্যবহারের দৃশ্য",
      "মৌসুম",
      "মূল বৈশিষ্ট্য",
      "উপাদান",
      "ফিচার",
a73a751f   tangwang   enrich
425
426
427
428
429
430
431
432
433
434
435
436
437
      "অ্যাঙ্কর টেক্সট"
    ],
    "pl": [
      "Nr",
      "Tytul produktu",
      "Sciezka kategorii",
      "Szczegolowe tagi",
      "Grupa docelowa",
      "Scenariusz uzycia",
      "Sezon",
      "Kluczowe atrybuty",
      "Material",
      "Cechy",
a73a751f   tangwang   enrich
438
439
440
441
442
443
444
445
446
447
448
449
450
      "Tekst kotwicy"
    ],
    "nl": [
      "Nr.",
      "Producttitel",
      "Categoriepad",
      "Gedetailleerde tags",
      "Doelgroep",
      "Gebruikscontext",
      "Seizoen",
      "Belangrijke kenmerken",
      "Materiaal",
      "Functies",
a73a751f   tangwang   enrich
451
452
453
454
455
456
457
458
459
460
461
462
463
      "Ankertekst"
    ],
    "ro": [
      "Nr.",
      "Titlul produsului",
      "Calea categoriei",
      "Etichete detaliate",
      "Public tinta",
      "Scenariu de utilizare",
      "Sezon",
      "Atribute cheie",
      "Material",
      "Caracteristici",
a73a751f   tangwang   enrich
464
465
466
467
468
469
470
471
472
473
474
475
476
      "Text ancora"
    ],
    "tr": [
      "No.",
      "Urun basligi",
      "Kategori yolu",
      "Ayrintili etiketler",
      "Hedef kitle",
      "Kullanim senaryosu",
      "Sezon",
      "Temel ozellikler",
      "Malzeme",
      "Ozellikler",
a73a751f   tangwang   enrich
477
478
479
480
481
482
483
484
485
486
487
488
489
      "Capa metni"
    ],
    "km": [
      "ល.រ",
      "ចំណងជើងផលិតផល",
      "ផ្លូវប្រភេទ",
      "ស្លាកលម្អិត",
      "ក្រុមអ្នកប្រើគោលដៅ",
      "សេណារីយ៉ូប្រើប្រាស់",
      "រដូវកាល",
      "លក្ខណៈសម្បត្តិសំខាន់",
      "សម្ភារៈ",
      "មុខងារ",
a73a751f   tangwang   enrich
490
491
492
493
494
495
496
497
498
499
500
501
502
      "អត្ថបទអង់ក័រ"
    ],
    "lo": [
      "ລຳດັບ",
      "ຊື່ສິນຄ້າ",
      "ເສັ້ນທາງໝວດໝູ່",
      "ແທັກລະອຽດ",
      "ກຸ່ມເປົ້າໝາຍ",
      "ສະຖານະການໃຊ້ງານ",
      "ລະດູການ",
      "ຄຸນລັກສະນະສຳຄັນ",
      "ວັດສະດຸ",
      "ຄຸນສົມບັດ",
a73a751f   tangwang   enrich
503
504
505
506
507
508
509
510
511
512
513
514
515
      "ຂໍ້ຄວາມອັງເຄີ"
    ],
    "yue": [
      "序號",
      "商品標題",
      "品類路徑",
      "細分類標籤",
      "適用人群",
      "使用場景",
      "適用季節",
      "關鍵屬性",
      "材質說明",
      "功能特點",
a73a751f   tangwang   enrich
516
517
518
519
520
521
522
523
524
525
526
527
528
      "錨文本"
    ],
    "cs": [
      "C.",
      "Nazev produktu",
      "Cesta kategorie",
      "Podrobne stitky",
      "Cilova skupina",
      "Scenar pouziti",
      "Sezona",
      "Klicove atributy",
      "Material",
      "Vlastnosti",
a73a751f   tangwang   enrich
529
530
531
532
533
534
535
536
537
538
539
540
541
      "Kotvici text"
    ],
    "el": [
      "Α/Α",
      "Τίτλος προϊόντος",
      "Διαδρομή κατηγορίας",
      "Αναλυτικές ετικέτες",
      "Κοινό-στόχος",
      "Σενάριο χρήσης",
      "Εποχή",
      "Βασικά χαρακτηριστικά",
      "Υλικό",
      "Λειτουργίες",
a73a751f   tangwang   enrich
542
543
544
545
546
547
548
549
550
551
552
553
554
      "Κείμενο άγκυρας"
    ],
    "sv": [
      "Nr",
      "Produkttitel",
      "Kategorisokvag",
      "Detaljerade taggar",
      "Malgrupp",
      "Anvandningsscenario",
      "Sasong",
      "Viktiga attribut",
      "Material",
      "Funktioner",
a73a751f   tangwang   enrich
555
556
557
558
559
560
561
562
563
564
565
566
567
      "Ankartext"
    ],
    "hu": [
      "Sorszam",
      "Termekcim",
      "Kategoriavonal",
      "Reszletes cimkek",
      "Celcsoport",
      "Hasznalati helyzet",
      "Evszak",
      "Fo jellemzok",
      "Anyag",
      "Funkciok",
a73a751f   tangwang   enrich
568
569
570
571
572
573
574
575
576
577
578
579
580
      "Horgonyszoveg"
    ],
    "da": [
      "Nr.",
      "Produkttitel",
      "Kategoristi",
      "Detaljerede tags",
      "Malgruppe",
      "Brugsscenarie",
      "Saeson",
      "Nogleattributter",
      "Materiale",
      "Funktioner",
a73a751f   tangwang   enrich
581
582
583
584
585
586
587
588
589
590
591
592
593
      "Ankertekst"
    ],
    "fi": [
      "Nro",
      "Tuotteen nimi",
      "Kategoriapolku",
      "Yksityiskohtaiset tunnisteet",
      "Kohdeyleiso",
      "Kayttotilanne",
      "Kausi",
      "Keskeiset ominaisuudet",
      "Materiaali",
      "Ominaisuudet",
a73a751f   tangwang   enrich
594
595
596
597
598
599
600
601
602
603
604
605
606
      "Ankkuriteksti"
    ],
    "uk": [
      "№",
      "Назва товару",
      "Шлях категорії",
      "Детальні теги",
      "Цільова аудиторія",
      "Сценарій використання",
      "Сезон",
      "Ключові атрибути",
      "Матеріал",
      "Особливості",
a73a751f   tangwang   enrich
607
608
609
610
611
612
613
614
615
616
617
618
619
      "Анкорний текст"
    ],
    "bg": [
      "№",
      "Заглавие на продукта",
      "Път на категорията",
      "Подробни тагове",
      "Целева аудитория",
      "Сценарий на употреба",
      "Сезон",
      "Ключови атрибути",
      "Материал",
      "Характеристики",
a73a751f   tangwang   enrich
620
621
      "Анкор текст"
    ]
a47416ec   tangwang   把融合逻辑改成乘法公式,并把 ES...
622
  }