product_enrich_prompts.py 38.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
#!/usr/bin/env python3

from typing import Any, Dict, Tuple

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."
)

SHARED_ANALYSIS_INSTRUCTION = """Analyze each input product text and fill these columns:

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

Rules:
- Keep the input order and row count exactly the same.
- Infer only from the provided input product text; if uncertain, prefer concise and broadly correct ecommerce wording.
- 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}"""

def _taxonomy_field(
    key: str,
    label: str,
    description: str,
    zh_label: str | None = None,
) -> Dict[str, str]:
    return {
        "key": key,
        "label": label,
        "description": description,
        "zh_label": zh_label or label,
    }


def _build_taxonomy_shared_instruction(profile_label: str, fields: Tuple[Dict[str, str], ...]) -> str:
    lines = [
        f"Analyze each input product text and fill the columns below using a {profile_label} attribute taxonomy.",
        "",
        "Output columns:",
    ]
    for idx, field in enumerate(fields, start=1):
        lines.append(f"{idx}. {field['label']}: {field['description']}")
    lines.extend(
        [
            "",
            "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:",
        ]
    )
    return "\n".join(lines)


def _make_taxonomy_profile(
    profile_label: str,
    fields: Tuple[Dict[str, str], ...],
    *,
    aliases: Tuple[str, ...],
    output_languages: Tuple[str, ...] = ("en",),
    zh_headers: Tuple[str, ...] = (),
) -> Dict[str, Any]:
    headers = {"en": ["No.", *[field["label"] for field in fields]]}
    if zh_headers:
        headers["zh"] = ["序号", *zh_headers]
    return {
        "profile_label": profile_label,
        "fields": fields,
        "aliases": aliases,
        "output_languages": output_languages,
        "shared_instruction": _build_taxonomy_shared_instruction(profile_label, fields),
        "markdown_table_headers": headers,
    }


APPAREL_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise ecommerce apparel category label, not a full marketing title", "品类"),
    _taxonomy_field("target_gender", "Target Gender", "intended gender only if clearly implied", "目标性别"),
    _taxonomy_field("age_group", "Age Group", "only if clearly implied, e.g. adults, kids, teens, toddlers, babies", "年龄段"),
    _taxonomy_field("season", "Season", "season(s) or all-season suitability only if supported", "适用季节"),
    _taxonomy_field("fit", "Fit", "body closeness, e.g. slim, regular, relaxed, oversized, fitted", "版型"),
    _taxonomy_field("silhouette", "Silhouette", "overall garment shape, e.g. straight, A-line, boxy, tapered, bodycon, wide-leg", "廓形"),
    _taxonomy_field("neckline", "Neckline", "neckline type when applicable, e.g. crew neck, V-neck, hooded, collared, square neck", "领型"),
    _taxonomy_field("sleeve_length_type", "Sleeve Length Type", "sleeve length only, e.g. sleeveless, short sleeve, long sleeve, three-quarter sleeve", "袖长类型"),
    _taxonomy_field("sleeve_style", "Sleeve Style", "sleeve design only, e.g. puff sleeve, raglan sleeve, batwing sleeve, bell sleeve", "袖型"),
    _taxonomy_field("strap_type", "Strap Type", "strap design when applicable, e.g. spaghetti strap, wide strap, halter strap, adjustable strap", "肩带设计"),
    _taxonomy_field("rise_waistline", "Rise / Waistline", "waist placement when applicable, e.g. high rise, mid rise, low rise, empire waist", "腰型"),
    _taxonomy_field("leg_shape", "Leg Shape", "for bottoms only, e.g. straight leg, wide leg, flare leg, tapered leg, skinny leg", "裤型"),
    _taxonomy_field("skirt_shape", "Skirt Shape", "for skirts only, e.g. A-line, pleated, pencil, mermaid", "裙型"),
    _taxonomy_field("length_type", "Length Type", "design length only, not size, e.g. cropped, regular, longline, mini, midi, maxi, ankle length, full length", "长度类型"),
    _taxonomy_field("closure_type", "Closure Type", "fastening method when applicable, e.g. zipper, button, drawstring, elastic waist, hook-and-loop", "闭合方式"),
    _taxonomy_field("design_details", "Design Details", "construction or visual details, e.g. ruched, ruffled, pleated, cut-out, layered, distressed, split hem", "设计细节"),
    _taxonomy_field("fabric", "Fabric", "fabric type only, e.g. denim, knit, chiffon, jersey, fleece, cotton twill", "面料"),
    _taxonomy_field("material_composition", "Material Composition", "fiber content or blend only if stated, e.g. cotton, polyester, spandex, linen blend, 95% cotton 5% elastane", "成分"),
    _taxonomy_field("fabric_properties", "Fabric Properties", "inherent fabric traits, e.g. stretch, breathable, lightweight, soft-touch, water-resistant", "面料特性"),
    _taxonomy_field("clothing_features", "Clothing Features", "product features, e.g. lined, reversible, hooded, packable, padded, pocketed", "服装特征"),
    _taxonomy_field("functional_benefits", "Functional Benefits", "wearer benefits, e.g. moisture-wicking, thermal insulation, UV protection, easy care, supportive compression", "功能"),
    _taxonomy_field("color", "Color", "specific color name when available", "主颜色"),
    _taxonomy_field("color_family", "Color Family", "normalized broad retail color group, e.g. black, white, blue, green, red, pink, beige, brown, gray", "色系"),
    _taxonomy_field("print_pattern", "Print / Pattern", "surface pattern when applicable, e.g. solid, striped, plaid, floral, graphic, animal print", "印花 / 图案"),
    _taxonomy_field("occasion_end_use", "Occasion / End Use", "likely use occasion only if supported, e.g. office, casual wear, streetwear, lounge, workout, outdoor", "适用场景"),
    _taxonomy_field("style_aesthetic", "Style Aesthetic", "overall style only if supported, e.g. minimalist, streetwear, athleisure, smart casual, romantic, playful", "风格"),
)

THREE_C_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise 3C accessory or peripheral category label"),
    _taxonomy_field("compatible_device", "Compatible Device / Model", "supported device family, series, model, or form factor when clearly stated"),
    _taxonomy_field("connectivity", "Connectivity", "connection method such as wired, wireless, Bluetooth, Wi-Fi, NFC, or 2.4G"),
    _taxonomy_field("interface_port_type", "Interface / Port Type", "relevant connector or port, e.g. USB-C, Lightning, HDMI, AUX, RJ45"),
    _taxonomy_field("power_charging", "Power Source / Charging", "charging or power mode, e.g. battery powered, fast charging, rechargeable, plug-in"),
    _taxonomy_field("key_features", "Key Features", "primary hardware features such as noise cancelling, foldable, magnetic, backlit, waterproof"),
    _taxonomy_field("material_finish", "Material / Finish", "main material or exterior finish when supported"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("pack_size", "Pack Size", "unit count or bundle size when stated"),
    _taxonomy_field("use_case", "Use Case", "intended usage such as travel, office, gaming, car, charging, streaming"),
)

BAGS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise bag category such as backpack, tote bag, crossbody bag, luggage, or wallet"),
    _taxonomy_field("target_gender", "Target Gender", "intended gender only if clearly implied"),
    _taxonomy_field("carry_style", "Carry Style", "how the bag is worn or carried, e.g. handheld, shoulder, crossbody, backpack"),
    _taxonomy_field("size_capacity", "Size / Capacity", "size tier or capacity when supported, e.g. mini, large capacity, 20L"),
    _taxonomy_field("material", "Material", "main bag material such as leather, nylon, canvas, PU, straw"),
    _taxonomy_field("closure_type", "Closure Type", "bag closure such as zipper, flap, buckle, drawstring, magnetic snap"),
    _taxonomy_field("structure_compartments", "Structure / Compartments", "organizational structure such as multi-pocket, laptop sleeve, card slots, expandable"),
    _taxonomy_field("strap_handle_type", "Strap / Handle Type", "strap or handle design such as chain strap, top handle, adjustable strap"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("occasion_end_use", "Occasion / End Use", "likely use such as commute, travel, evening, school, casual"),
)

PET_SUPPLIES_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise pet supplies category label"),
    _taxonomy_field("pet_type", "Pet Type", "target pet such as dog, cat, bird, fish, hamster"),
    _taxonomy_field("breed_size", "Breed Size", "pet size or breed size when stated, e.g. small breed, large dogs"),
    _taxonomy_field("life_stage", "Life Stage", "pet age stage when supported, e.g. puppy, kitten, adult, senior"),
    _taxonomy_field("material_ingredients", "Material / Ingredients", "main material or ingredient composition when supported"),
    _taxonomy_field("flavor_scent", "Flavor / Scent", "flavor or scent when applicable"),
    _taxonomy_field("key_features", "Key Features", "primary attributes such as interactive, leak-proof, orthopedic, washable, elevated"),
    _taxonomy_field("functional_benefits", "Functional Benefits", "benefits such as dental care, calming, digestion support, joint support"),
    _taxonomy_field("size_capacity", "Size / Capacity", "size, count, or net content when stated"),
    _taxonomy_field("use_scenario", "Use Scenario", "usage such as feeding, training, grooming, travel, indoor play"),
)

ELECTRONICS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise electronics device or component category label"),
    _taxonomy_field("device_category", "Device Category / Compatibility", "supported platform, component class, or compatible device family when stated"),
    _taxonomy_field("power_voltage", "Power / Voltage", "power, voltage, wattage, or battery spec when supported"),
    _taxonomy_field("connectivity", "Connectivity", "connection method such as wired, Bluetooth, Wi-Fi, RF, or smart app control"),
    _taxonomy_field("interface_port_type", "Interface / Port Type", "relevant port or interface such as USB-C, AC plug type, HDMI, SATA"),
    _taxonomy_field("capacity_storage", "Capacity / Storage", "capacity or storage spec such as 256GB, 2TB, 5000mAh"),
    _taxonomy_field("key_features", "Key Features", "main product features such as touch control, HD display, noise reduction, smart control"),
    _taxonomy_field("material_finish", "Material / Finish", "main housing material or finish when supported"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("use_case", "Use Case", "intended use such as home entertainment, office, charging, security, repair"),
)

OUTDOOR_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise outdoor gear category label"),
    _taxonomy_field("activity_type", "Activity Type", "primary outdoor activity such as camping, hiking, fishing, climbing, travel"),
    _taxonomy_field("season_weather", "Season / Weather", "season or weather suitability when supported"),
    _taxonomy_field("material", "Material", "main material such as aluminum, ripstop nylon, stainless steel, EVA"),
    _taxonomy_field("capacity_size", "Capacity / Size", "size, length, or capacity when stated"),
    _taxonomy_field("protection_resistance", "Protection / Resistance", "resistance or protection such as waterproof, UV resistant, windproof"),
    _taxonomy_field("key_features", "Key Features", "primary gear attributes such as foldable, lightweight, insulated, non-slip"),
    _taxonomy_field("portability_packability", "Portability / Packability", "carry or storage trait such as collapsible, compact, ultralight, packable"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("use_scenario", "Use Scenario", "likely use setting such as campsite, trail, survival kit, beach, picnic"),
)

HOME_APPLIANCES_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise home appliance category label"),
    _taxonomy_field("appliance_category", "Appliance Category", "functional class such as kitchen appliance, cleaning appliance, personal care appliance"),
    _taxonomy_field("power_voltage", "Power / Voltage", "wattage, voltage, plug type, or power supply when supported"),
    _taxonomy_field("capacity_coverage", "Capacity / Coverage", "capacity or coverage metric such as 1.5L, 20L, 40sqm"),
    _taxonomy_field("control_method", "Control Method", "operation method such as touch, knob, remote, app control"),
    _taxonomy_field("installation_type", "Installation Type", "setup style such as countertop, handheld, portable, wall-mounted, built-in"),
    _taxonomy_field("key_features", "Key Features", "main product features such as timer, steam, HEPA filter, self-cleaning"),
    _taxonomy_field("material_finish", "Material / Finish", "main material or exterior finish when supported"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("use_scenario", "Use Scenario", "intended use such as cooking, cleaning, grooming, cooling, air treatment"),
)

HOME_LIVING_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise home and living category label"),
    _taxonomy_field("room_placement", "Room / Placement", "intended room or placement such as bedroom, kitchen, bathroom, desktop"),
    _taxonomy_field("material", "Material", "main material such as wood, ceramic, cotton, glass, metal"),
    _taxonomy_field("style", "Style", "home style such as modern, farmhouse, minimalist, boho, Nordic"),
    _taxonomy_field("size_dimensions", "Size / Dimensions", "size or dimensions when stated"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("pattern_finish", "Pattern / Finish", "surface pattern or finish such as solid, marble, matte, ribbed"),
    _taxonomy_field("key_features", "Key Features", "main product features such as stackable, washable, blackout, space-saving"),
    _taxonomy_field("assembly_installation", "Assembly / Installation", "assembly or installation trait when supported"),
    _taxonomy_field("use_scenario", "Use Scenario", "intended use such as storage, dining, decor, sleep, organization"),
)

WIGS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise wig or hairpiece category label"),
    _taxonomy_field("hair_material", "Hair Material", "hair material such as human hair, synthetic fiber, heat-resistant fiber"),
    _taxonomy_field("hair_texture", "Hair Texture", "texture or curl pattern such as straight, body wave, curly, kinky"),
    _taxonomy_field("hair_length", "Hair Length", "hair length when stated"),
    _taxonomy_field("hair_color", "Hair Color", "specific hair color or blend when available"),
    _taxonomy_field("cap_construction", "Cap Construction", "cap type such as full lace, lace front, glueless, U part"),
    _taxonomy_field("lace_area_part_type", "Lace Area / Part Type", "lace size or part style such as 13x4 lace, middle part, T part"),
    _taxonomy_field("density_volume", "Density / Volume", "hair density or fullness when supported"),
    _taxonomy_field("style_bang_type", "Style / Bang Type", "style cue such as bob, pixie, layered, with bangs"),
    _taxonomy_field("occasion_end_use", "Occasion / End Use", "intended use such as daily wear, cosplay, protective style, party"),
)

BEAUTY_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise beauty or cosmetics category label"),
    _taxonomy_field("target_area", "Target Area", "target area such as face, lips, eyes, nails, hair, body"),
    _taxonomy_field("skin_hair_type", "Skin Type / Hair Type", "suitable skin or hair type when supported"),
    _taxonomy_field("finish_effect", "Finish / Effect", "cosmetic finish or effect such as matte, dewy, volumizing, brightening"),
    _taxonomy_field("key_ingredients", "Key Ingredients", "notable ingredients when stated"),
    _taxonomy_field("shade_color", "Shade / Color", "specific shade or color when available"),
    _taxonomy_field("scent", "Scent", "fragrance or scent only when supported"),
    _taxonomy_field("formulation", "Formulation", "product form such as cream, serum, powder, gel, stick"),
    _taxonomy_field("functional_benefits", "Functional Benefits", "benefits such as hydration, anti-aging, long-wear, repair, sun protection"),
    _taxonomy_field("use_scenario", "Use Scenario", "intended use such as daily routine, salon, travel, evening makeup"),
)

ACCESSORIES_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise accessory category label such as necklace, watch, belt, hat, or sunglasses"),
    _taxonomy_field("target_gender", "Target Gender", "intended gender only if clearly implied"),
    _taxonomy_field("material", "Material", "main material such as alloy, leather, stainless steel, acetate, fabric"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("pattern_finish", "Pattern / Finish", "surface treatment or style finish such as polished, textured, braided, rhinestone"),
    _taxonomy_field("closure_fastening", "Closure / Fastening", "fastening method when applicable"),
    _taxonomy_field("size_fit", "Size / Fit", "size or fit information such as adjustable, one size, 42mm"),
    _taxonomy_field("style", "Style", "style cue such as minimalist, vintage, statement, sporty"),
    _taxonomy_field("occasion_end_use", "Occasion / End Use", "likely use such as daily wear, formal, party, travel, sun protection"),
    _taxonomy_field("set_pack_size", "Set / Pack Size", "set count or pack size when stated"),
)

TOYS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise toy category label"),
    _taxonomy_field("age_group", "Age Group", "intended age group when clearly implied"),
    _taxonomy_field("character_theme", "Character / Theme", "licensed character, theme, or play theme when supported"),
    _taxonomy_field("material", "Material", "main toy material such as plush, plastic, wood, silicone"),
    _taxonomy_field("power_source", "Power Source", "battery, rechargeable, wind-up, or non-powered when supported"),
    _taxonomy_field("interactive_features", "Interactive Features", "interactive functions such as sound, lights, remote control, motion"),
    _taxonomy_field("educational_play_value", "Educational / Play Value", "play value such as STEM, pretend play, sensory, puzzle solving"),
    _taxonomy_field("piece_count_size", "Piece Count / Size", "piece count or size when stated"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("use_scenario", "Use Scenario", "intended use such as indoor play, bath time, party favor, outdoor play"),
)

SHOES_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise footwear category label"),
    _taxonomy_field("target_gender", "Target Gender", "intended gender only if clearly implied"),
    _taxonomy_field("age_group", "Age Group", "only if clearly implied"),
    _taxonomy_field("closure_type", "Closure Type", "fastening method such as lace-up, slip-on, buckle, hook-and-loop"),
    _taxonomy_field("toe_shape", "Toe Shape", "toe shape when applicable, e.g. round toe, pointed toe, open toe"),
    _taxonomy_field("heel_sole_type", "Heel Height / Sole Type", "heel or sole profile such as flat, block heel, wedge, platform, thick sole"),
    _taxonomy_field("upper_material", "Upper Material", "main upper material such as leather, knit, canvas, mesh"),
    _taxonomy_field("lining_insole_material", "Lining / Insole Material", "lining or insole material when supported"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("occasion_end_use", "Occasion / End Use", "likely use such as running, casual, office, hiking, formal"),
)

SPORTS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise sports product category label"),
    _taxonomy_field("sport_activity", "Sport / Activity", "primary sport or activity such as fitness, yoga, basketball, cycling, swimming"),
    _taxonomy_field("skill_level", "Skill Level", "target user level when supported, e.g. beginner, training, professional"),
    _taxonomy_field("material", "Material", "main material such as EVA, carbon fiber, neoprene, latex"),
    _taxonomy_field("size_capacity", "Size / Capacity", "size, weight, resistance level, or capacity when stated"),
    _taxonomy_field("protection_support", "Protection / Support", "support or protection function such as ankle support, shock absorption, impact protection"),
    _taxonomy_field("key_features", "Key Features", "main features such as anti-slip, adjustable, foldable, quick-dry"),
    _taxonomy_field("power_source", "Power Source", "battery, electric, or non-powered when applicable"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("use_scenario", "Use Scenario", "intended use such as gym, home workout, field training, competition"),
)

OTHERS_TAXONOMY_FIELDS = (
    _taxonomy_field("product_type", "Product Type", "concise product category label, not a full marketing title"),
    _taxonomy_field("product_category", "Product Category", "broader retail grouping when the specific product type is narrow"),
    _taxonomy_field("target_user", "Target User", "intended user, audience, or recipient when clearly implied"),
    _taxonomy_field("material_ingredients", "Material / Ingredients", "main material or ingredients when supported"),
    _taxonomy_field("key_features", "Key Features", "primary product attributes or standout features"),
    _taxonomy_field("functional_benefits", "Functional Benefits", "practical benefits or performance advantages when supported"),
    _taxonomy_field("size_capacity", "Size / Capacity", "size, count, weight, or capacity when stated"),
    _taxonomy_field("color", "Color", "specific color name when available"),
    _taxonomy_field("style_theme", "Style / Theme", "overall style, design theme, or visual direction when supported"),
    _taxonomy_field("use_scenario", "Use Scenario", "likely use occasion or application setting when supported"),
)

CATEGORY_TAXONOMY_PROFILES: Dict[str, Dict[str, Any]] = {
    "apparel": _make_taxonomy_profile(
        "apparel",
        APPAREL_TAXONOMY_FIELDS,
        aliases=("服装", "服饰", "apparel", "clothing", "fashion"),
        output_languages=("zh", "en"),
        zh_headers=tuple(field["zh_label"] for field in APPAREL_TAXONOMY_FIELDS),
    ),
    "3c": _make_taxonomy_profile(
        "3C",
        THREE_C_TAXONOMY_FIELDS,
        aliases=("3c", "数码", "phone accessories", "computer peripherals", "smart wearables", "audio", "gaming gear"),
    ),
    "bags": _make_taxonomy_profile(
        "bags",
        BAGS_TAXONOMY_FIELDS,
        aliases=("bags", "bag", "包", "箱包", "handbag", "backpack", "wallet", "luggage"),
    ),
    "pet_supplies": _make_taxonomy_profile(
        "pet supplies",
        PET_SUPPLIES_TAXONOMY_FIELDS,
        aliases=("pet", "宠物", "pet supplies", "pet food", "pet toys", "pet care"),
    ),
    "electronics": _make_taxonomy_profile(
        "electronics",
        ELECTRONICS_TAXONOMY_FIELDS,
        aliases=("electronics", "电子", "electronic components", "consumer electronics", "digital devices"),
    ),
    "outdoor": _make_taxonomy_profile(
        "outdoor products",
        OUTDOOR_TAXONOMY_FIELDS,
        aliases=("outdoor", "户外", "camping", "hiking", "fishing", "travel accessories"),
    ),
    "home_appliances": _make_taxonomy_profile(
        "home appliances",
        HOME_APPLIANCES_TAXONOMY_FIELDS,
        aliases=("home appliances", "家电", "电器", "kitchen appliances", "cleaning appliances", "smart home devices"),
    ),
    "home_living": _make_taxonomy_profile(
        "home and living",
        HOME_LIVING_TAXONOMY_FIELDS,
        aliases=("home", "living", "家居", "家具", "家纺", "home decor", "kitchenware"),
    ),
    "wigs": _make_taxonomy_profile(
        "wigs",
        WIGS_TAXONOMY_FIELDS,
        aliases=("wig", "wigs", "假发", "hairpiece"),
    ),
    "beauty": _make_taxonomy_profile(
        "beauty and cosmetics",
        BEAUTY_TAXONOMY_FIELDS,
        aliases=("beauty", "cosmetics", "美容", "美妆", "makeup", "skincare", "nail care"),
    ),
    "accessories": _make_taxonomy_profile(
        "accessories",
        ACCESSORIES_TAXONOMY_FIELDS,
        aliases=("accessories", "配饰", "jewelry", "watches", "belts", "scarves", "hats", "sunglasses"),
    ),
    "toys": _make_taxonomy_profile(
        "toys",
        TOYS_TAXONOMY_FIELDS,
        aliases=("toys", "toy", "玩具", "plush", "action figures", "puzzles", "educational toys"),
    ),
    "shoes": _make_taxonomy_profile(
        "shoes",
        SHOES_TAXONOMY_FIELDS,
        aliases=("shoes", "shoe", "鞋", "sneakers", "boots", "sandals", "heels"),
    ),
    "sports": _make_taxonomy_profile(
        "sports products",
        SPORTS_TAXONOMY_FIELDS,
        aliases=("sports", "sport", "运动", "fitness", "cycling", "team sports", "water sports"),
    ),
    "others": _make_taxonomy_profile(
        "general merchandise",
        OTHERS_TAXONOMY_FIELDS,
        aliases=("others", "other", "其他", "general merchandise"),
    ),
}

CATEGORY_TAXONOMY_PROFILE_NAMES = tuple(CATEGORY_TAXONOMY_PROFILES.keys())
TAXONOMY_SHARED_ANALYSIS_INSTRUCTION = CATEGORY_TAXONOMY_PROFILES["apparel"]["shared_instruction"]
TAXONOMY_MARKDOWN_TABLE_HEADERS_EN = CATEGORY_TAXONOMY_PROFILES["apparel"]["markdown_table_headers"]["en"]
TAXONOMY_LANGUAGE_MARKDOWN_TABLE_HEADERS: Dict[str, Dict[str, Any]] = CATEGORY_TAXONOMY_PROFILES["apparel"]["markdown_table_headers"]

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",
    "Anchor text"
  ],
  "zh": [
    "序号",
    "商品标题",
    "品类路径",
    "细分标签",
    "适用人群",
    "使用场景",
    "适用季节",
    "关键属性",
    "材质说明",
    "功能特点",
    "锚文本"
  ],
  "zh_tw": [
    "序號",
    "商品標題",
    "品類路徑",
    "細分標籤",
    "適用人群",
    "使用場景",
    "適用季節",
    "關鍵屬性",
    "材質說明",
    "功能特點",
    "錨文本"
  ],
  "ru": [
    "№",
    "Название товара",
    "Путь категории",
    "Детализированные теги",
    "Целевая аудитория",
    "Сценарий использования",
    "Сезон",
    "Ключевые атрибуты",
    "Материал",
    "Особенности",
    "Анкорный текст"
  ],
  "ja": [
    "番号",
    "商品タイトル",
    "カテゴリパス",
    "詳細タグ",
    "対象ユーザー",
    "利用シーン",
    "季節",
    "主要属性",
    "素材",
    "機能特徴",
    "アンカーテキスト"
  ],
  "ko": [
    "번호",
    "상품 제목",
    "카테고리 경로",
    "세부 태그",
    "대상 고객",
    "사용 장면",
    "계절",
    "핵심 속성",
    "소재",
    "기능 특징",
    "앵커 텍스트"
  ],
  "es": [
    "N.º",
    "Titulo del producto",
    "Ruta de categoria",
    "Etiquetas detalladas",
    "Publico objetivo",
    "Escenario de uso",
    "Temporada",
    "Atributos clave",
    "Material",
    "Caracteristicas",
    "Texto ancla"
  ],
  "fr": [
    "N°",
    "Titre du produit",
    "Chemin de categorie",
    "Etiquettes detaillees",
    "Public cible",
    "Scenario d'utilisation",
    "Saison",
    "Attributs cles",
    "Matiere",
    "Caracteristiques",
    "Texte d'ancrage"
  ],
  "pt": [
    "Nº",
    "Titulo do produto",
    "Caminho da categoria",
    "Tags detalhadas",
    "Publico-alvo",
    "Cenario de uso",
    "Estacao",
    "Atributos principais",
    "Material",
    "Caracteristicas",
    "Texto ancora"
  ],
  "de": [
    "Nr.",
    "Produkttitel",
    "Kategoriepfad",
    "Detaillierte Tags",
    "Zielgruppe",
    "Nutzungsszenario",
    "Saison",
    "Wichtige Attribute",
    "Material",
    "Funktionen",
    "Ankertext"
  ],
  "it": [
    "N.",
    "Titolo del prodotto",
    "Percorso categoria",
    "Tag dettagliati",
    "Pubblico target",
    "Scenario d'uso",
    "Stagione",
    "Attributi chiave",
    "Materiale",
    "Caratteristiche",
    "Testo ancora"
  ],
  "th": [
    "ลำดับ",
    "ชื่อสินค้า",
    "เส้นทางหมวดหมู่",
    "แท็กย่อย",
    "กลุ่มเป้าหมาย",
    "สถานการณ์การใช้งาน",
    "ฤดูกาล",
    "คุณสมบัติสำคัญ",
    "วัสดุ",
    "คุณสมบัติการใช้งาน",
    "แองเคอร์เท็กซ์"
  ],
  "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",
    "Van ban neo"
  ],
  "id": [
    "No.",
    "Judul produk",
    "Jalur kategori",
    "Tag terperinci",
    "Target pengguna",
    "Skenario penggunaan",
    "Musim",
    "Atribut utama",
    "Bahan",
    "Fitur",
    "Teks jangkar"
  ],
  "ms": [
    "No.",
    "Tajuk produk",
    "Laluan kategori",
    "Tag terperinci",
    "Sasaran pengguna",
    "Senario penggunaan",
    "Musim",
    "Atribut utama",
    "Bahan",
    "Ciri-ciri",
    "Teks sauh"
  ],
  "ar": [
    "الرقم",
    "عنوان المنتج",
    "مسار الفئة",
    "الوسوم التفصيلية",
    "الفئة المستهدفة",
    "سيناريو الاستخدام",
    "الموسم",
    "السمات الرئيسية",
    "المادة",
    "الميزات",
    "نص الربط"
  ],
  "hi": [
    "क्रमांक",
    "उत्पाद शीर्षक",
    "श्रेणी पथ",
    "विस्तृत टैग",
    "लक्षित उपभोक्ता",
    "उपयोग परिदृश्य",
    "मौसम",
    "मुख्य गुण",
    "सामग्री",
    "विशेषताएं",
    "एंकर टेक्स्ट"
  ],
  "he": [
    "מס׳",
    "כותרת המוצר",
    "נתיב קטגוריה",
    "תגיות מפורטות",
    "קהל יעד",
    "תרחיש שימוש",
    "עונה",
    "מאפיינים מרכזיים",
    "חומר",
    "תכונות",
    "טקסט עוגן"
  ],
  "my": [
    "အမှတ်စဉ်",
    "ကုန်ပစ္စည်းခေါင်းစဉ်",
    "အမျိုးအစားလမ်းကြောင်း",
    "အသေးစိတ်တဂ်များ",
    "ပစ်မှတ်အသုံးပြုသူ",
    "အသုံးပြုမှုအခြေအနေ",
    "ရာသီ",
    "အဓိကဂုဏ်သတ္တိများ",
    "ပစ္စည်း",
    "လုပ်ဆောင်ချက်များ",
    "အန်ကာစာသား"
  ],
  "ta": [
    "எண்",
    "தயாரிப்பு தலைப்பு",
    "வகை பாதை",
    "விரிவான குறிச்சொற்கள்",
    "இலக்கு பயனர்கள்",
    "பயன்பாட்டு நிலை",
    "பருவம்",
    "முக்கிய பண்புகள்",
    "பொருள்",
    "அம்சங்கள்",
    "ஆங்கர் உரை"
  ],
  "ur": [
    "نمبر",
    "پروڈکٹ عنوان",
    "زمرہ راستہ",
    "تفصیلی ٹیگز",
    "ہدف صارفین",
    "استعمال کا منظر",
    "موسم",
    "کلیدی خصوصیات",
    "مواد",
    "فیچرز",
    "اینکر ٹیکسٹ"
  ],
  "bn": [
    "ক্রম",
    "পণ্যের শিরোনাম",
    "শ্রেণি পথ",
    "বিস্তারিত ট্যাগ",
    "লক্ষ্য ব্যবহারকারী",
    "ব্যবহারের দৃশ্য",
    "মৌসুম",
    "মূল বৈশিষ্ট্য",
    "উপাদান",
    "ফিচার",
    "অ্যাঙ্কর টেক্সট"
  ],
  "pl": [
    "Nr",
    "Tytul produktu",
    "Sciezka kategorii",
    "Szczegolowe tagi",
    "Grupa docelowa",
    "Scenariusz uzycia",
    "Sezon",
    "Kluczowe atrybuty",
    "Material",
    "Cechy",
    "Tekst kotwicy"
  ],
  "nl": [
    "Nr.",
    "Producttitel",
    "Categoriepad",
    "Gedetailleerde tags",
    "Doelgroep",
    "Gebruikscontext",
    "Seizoen",
    "Belangrijke kenmerken",
    "Materiaal",
    "Functies",
    "Ankertekst"
  ],
  "ro": [
    "Nr.",
    "Titlul produsului",
    "Calea categoriei",
    "Etichete detaliate",
    "Public tinta",
    "Scenariu de utilizare",
    "Sezon",
    "Atribute cheie",
    "Material",
    "Caracteristici",
    "Text ancora"
  ],
  "tr": [
    "No.",
    "Urun basligi",
    "Kategori yolu",
    "Ayrintili etiketler",
    "Hedef kitle",
    "Kullanim senaryosu",
    "Sezon",
    "Temel ozellikler",
    "Malzeme",
    "Ozellikler",
    "Capa metni"
  ],
  "km": [
    "ល.រ",
    "ចំណងជើងផលិតផល",
    "ផ្លូវប្រភេទ",
    "ស្លាកលម្អិត",
    "ក្រុមអ្នកប្រើគោលដៅ",
    "សេណារីយ៉ូប្រើប្រាស់",
    "រដូវកាល",
    "លក្ខណៈសម្បត្តិសំខាន់",
    "សម្ភារៈ",
    "មុខងារ",
    "អត្ថបទអង់ក័រ"
  ],
  "lo": [
    "ລຳດັບ",
    "ຊື່ສິນຄ້າ",
    "ເສັ້ນທາງໝວດໝູ່",
    "ແທັກລະອຽດ",
    "ກຸ່ມເປົ້າໝາຍ",
    "ສະຖານະການໃຊ້ງານ",
    "ລະດູການ",
    "ຄຸນລັກສະນະສຳຄັນ",
    "ວັດສະດຸ",
    "ຄຸນສົມບັດ",
    "ຂໍ້ຄວາມອັງເຄີ"
  ],
  "yue": [
    "序號",
    "商品標題",
    "品類路徑",
    "細分類標籤",
    "適用人群",
    "使用場景",
    "適用季節",
    "關鍵屬性",
    "材質說明",
    "功能特點",
    "錨文本"
  ],
  "cs": [
    "C.",
    "Nazev produktu",
    "Cesta kategorie",
    "Podrobne stitky",
    "Cilova skupina",
    "Scenar pouziti",
    "Sezona",
    "Klicove atributy",
    "Material",
    "Vlastnosti",
    "Kotvici text"
  ],
  "el": [
    "Α/Α",
    "Τίτλος προϊόντος",
    "Διαδρομή κατηγορίας",
    "Αναλυτικές ετικέτες",
    "Κοινό-στόχος",
    "Σενάριο χρήσης",
    "Εποχή",
    "Βασικά χαρακτηριστικά",
    "Υλικό",
    "Λειτουργίες",
    "Κείμενο άγκυρας"
  ],
  "sv": [
    "Nr",
    "Produkttitel",
    "Kategorisokvag",
    "Detaljerade taggar",
    "Malgrupp",
    "Anvandningsscenario",
    "Sasong",
    "Viktiga attribut",
    "Material",
    "Funktioner",
    "Ankartext"
  ],
  "hu": [
    "Sorszam",
    "Termekcim",
    "Kategoriavonal",
    "Reszletes cimkek",
    "Celcsoport",
    "Hasznalati helyzet",
    "Evszak",
    "Fo jellemzok",
    "Anyag",
    "Funkciok",
    "Horgonyszoveg"
  ],
  "da": [
    "Nr.",
    "Produkttitel",
    "Kategoristi",
    "Detaljerede tags",
    "Malgruppe",
    "Brugsscenarie",
    "Saeson",
    "Nogleattributter",
    "Materiale",
    "Funktioner",
    "Ankertekst"
  ],
  "fi": [
    "Nro",
    "Tuotteen nimi",
    "Kategoriapolku",
    "Yksityiskohtaiset tunnisteet",
    "Kohdeyleiso",
    "Kayttotilanne",
    "Kausi",
    "Keskeiset ominaisuudet",
    "Materiaali",
    "Ominaisuudet",
    "Ankkuriteksti"
  ],
  "uk": [
    "№",
    "Назва товару",
    "Шлях категорії",
    "Детальні теги",
    "Цільова аудиторія",
    "Сценарій використання",
    "Сезон",
    "Ключові атрибути",
    "Матеріал",
    "Особливості",
    "Анкорний текст"
  ],
  "bg": [
    "№",
    "Заглавие на продукта",
    "Път на категорията",
    "Подробни тагове",
    "Целева аудитория",
    "Сценарий на употреба",
    "Сезон",
    "Ключови атрибути",
    "Материал",
    "Характеристики",
    "Анкор текст"
  ]
}