P paper2skillsPlaybook
开始业务诊断
访客模式
22-数据采集工程

Product Attribute Completion — 商品属性自动补全:AI 填补 Listing 属性空白

Skill-Product-Attribute-Completion

声明类型推断验证状态待复核

新款吸奶器需要填写42个属性字段人工填写1.5小时但30-40%属性空白导致搜索排名下降——AI从标题/要点/图片自动提取属性值5分钟完成,属性完整度60%提升到90%搜索曝光增加20-35%年化15-40万元

来源
paper2skills-vault/22-数据采集工程/Skill-Product-Attribute-Completion.md
适用边界
论文方法到业务问题的项目侧映射,不自动证明客户根因。
声明类型示例验证状态待企业数据验证

¥20-50 万

来源
paper2skills-vault/22-数据采集工程/Skill-Product-Attribute-Completion.md#business-value
适用边界
方法估算或场景示例,不等于客户结果或收益承诺。

待企业数据验证 · 缺失:样本、基线、时间窗、币种、计算方法、证据来源

业务视角
适用角色数据工程师 / 技术负责人 · 运营负责人 · 选品负责人
适用平台Amazon SP API + Keepa · TikTok Shop API · 跨境多平台数据湖
什么情况下用想监控竞品价格/评论/排名但没有稳定采集能力,手动太慢;多平台数据分散整合成本极高;数据管道不稳定经常断
示例目标(需企业数据验证)竞品价格/评论数据每日自动更新,多平台数据统一入仓,数据管道稳定性 >99%,取数时间从小时降到分钟
业务痛点
竞品数据要手动收集太慢平台 API 限制抓不到数据多系统数据整合不起来报表用的数据是过期的

1. 解决的问题

新款吸奶器需要填写42个属性字段人工填写1.5小时但30-40%属性空白导致搜索排名下降——AI从标题/要点/图片自动提取属性值5分钟完成,属性完整度60%提升到90%搜索曝光增加20-35%年化15-40万元

2. 核心算法逻辑

核心思想

人工填属性 vs AI 补全:

人工填写(现状):
  每个 SKU 40+ 个属性 × 500 个 SKU = 20,000 个属性值
  每个属性 2 分钟 × 20,000 = 667 小时 ≈ 4 个月人工
  
AI 属性补全(目标):
  输入: 商品图片 + 标题 + 已有部分属性
  输出: 预测所有空白属性值
  时间: 500 个 SKU × 1 秒/SKU = 8 分钟

多模态属性提取(图片+文本):

来源1: 标题文本
  "Ultra-Quiet Double Electric Breast Pump <45dB USB Rechargeable"
  → 噪音等级: <45dB  类型: 双边电动  充电方式: USB

来源2: Bullet Points
  "3 suction levels and 9 intensity settings"
  → 吸力档位: 3档  强度设置: 9档

来源3: 产品图片
  主图包含"安静马达"图标 + "<45dB"文字
  → 噪音等级: <45dB(与文本交叉验证)

来源4: 同类竞品属性(知识迁移)
  同品类已有属性的语义相似商品 → 推断缺失属性

属性类型处理策略:

属性类型提取方法示例
数值型正则+NLP重量:2.1kg, 噪音:<45dB
类别型分类模型颜色:白色, 类型:双边电动
布尔型关键词检测BPA-free:是, 防回流:是
自由文本摘要提取适用人群:哺乳期妈妈

3. 业务应用场景

业务问题:新款吸奶器上架需要填写 42 个属性字段(Amazon 要求的 ASIN 属性),运营一个一个填写需要 1.5 小时/SKU,10 款新品需要 15 小时。AI 补全可以 10 秒完成,运营只需要复核高置信度的属性。

数据要求: - 商品标题/要点/描述(已有文本) - 商品主图(可选,提升精度) - 品类属性模板(Amazon 要求的属性字段列表)

预期产出: - 所有属性的预测值(含置信度) - 高置信度(>0.85)自动填充,低置信度标记为"需人工确认" - 属性填充前后的搜索曝光预期提升

4. 输入数据要求

  • 商品标题/要点/描述(已有文本)
  • 商品主图(可选,提升精度)
  • 品类属性模板(Amazon 要求的属性字段列表)

5. 输出结果

  • 所有属性的预测值(含置信度)
  • 高置信度(>0.85)自动填充,低置信度标记为"需人工确认"
  • 属性填充前后的搜索曝光预期提升

6. 业务价值与 ROI

  • ROI 预估:
  • 属性填写效率提升 18x(90分钟 → 5分钟/SKU)
  • 属性完整度 60% → 90%:A10 排名权重提升,搜索曝光 +20-35%
  • 批量历史 SKU 处理:月增 GMV ¥5-20 万
  • 年化综合 ROI:¥20-50 万
  • 实施难度:⭐⭐☆☆☆(规则引擎版 1 周可实现;LLM 增强版约 2-3 周;需要品类属性模板建立)

7. 代码模板

代码块数量:3

Python160 行 · 完整显示
"""
Product Attribute Completion
商品属性自动补全:从文本+图片提取属性值
"""
import re
from dataclasses import dataclass
from typing import Optional


@dataclass
class AttributeDefinition:
    name: str
    attr_type: str    # 'numeric', 'categorical', 'boolean', 'text'
    required: bool = False
    extraction_patterns: list = None


# 母婴吸奶器品类属性模板
BREAST_PUMP_ATTRIBUTES = [
    AttributeDefinition('noise_level_db', 'numeric', required=True,
                         extraction_patterns=[r'<?\s*(\d+)\s*dB', r'under\s*(\d+)\s*dB']),
    AttributeDefinition('pump_type', 'categorical', required=True,
                         extraction_patterns=[r'(single|double|dual)\s*(electric|breast)', r'(wearable|portable|hands-free)']),
    AttributeDefinition('power_source', 'categorical', required=True,
                         extraction_patterns=[r'(USB|AC|battery|rechargeable|electric)\s*(rechargeable|powered|charging)?']),
    AttributeDefinition('suction_levels', 'numeric',
                         extraction_patterns=[r'(\d+)\s*suction\s*(level|mode|setting)', r'(\d+)\s*level']),
    AttributeDefinition('bpa_free', 'boolean',
                         extraction_patterns=[r'BPA[\s-]?free', r'BPA[\s-]?Free', r'non[\s-]?BPA']),
    AttributeDefinition('weight_kg', 'numeric',
                         extraction_patterns=[r'(\d+\.?\d*)\s*(lb|lbs|kg|pounds?)', r'lightweight']),
    AttributeDefinition('warranty_years', 'numeric',
                         extraction_patterns=[r'(\d+)[\s-]?(year|yr)\s*(warranty|guarantee)']),
    AttributeDefinition('compatible_brands', 'text',
                         extraction_patterns=[r'compatible with\s+(\w+)', r'works with\s+(\w+)']),
]


def extract_attribute_from_text(text: str, attr_def: AttributeDefinition) -> dict:
    """从文本提取单个属性值"""
    text_normalized = re.sub(r'\s+', ' ', text.strip())

    for pattern in (attr_def.extraction_patterns or []):
        match = re.search(pattern, text_normalized, re.IGNORECASE)
        if match:
            raw_value = match.group(1) if match.lastindex else match.group(0)

            # 类型转换
            if attr_def.attr_type == 'numeric':
                try:
                    value = float(raw_value.replace(',', ''))
                    return {'value': value, 'confidence': 0.90, 'source': 'text_regex'}
                except:
                    pass
            elif attr_def.attr_type == 'boolean':
                return {'value': True, 'confidence': 0.95, 'source': 'text_keyword'}
            elif attr_def.attr_type == 'categorical':
                return {'value': raw_value.strip().title(), 'confidence': 0.85, 'source': 'text_regex'}
            else:
                return {'value': raw_value.strip(), 'confidence': 0.75, 'source': 'text_regex'}

    # 特殊处理 bpa_free 的否定情况
    if attr_def.name == 'bpa_free' and 'BPA' not in text.upper():
        return {'value': None, 'confidence': 0.3, 'source': 'not_found'}

    return {'value': None, 'confidence': 0.0, 'source': 'not_found'}


def complete_product_attributes(listing_text: str,
                                  existing_attrs: dict = None,
                                  confidence_threshold: float = 0.8) -> dict:
    """
    批量补全商品属性
    listing_text: 标题 + bullets + 描述 的合并文本
    existing_attrs: 已有属性(不重复提取)
    """
    if existing_attrs is None:
        existing_attrs = {}

    results = {}
    auto_filled = []
    needs_review = []
    not_found = []

    for attr_def in BREAST_PUMP_ATTRIBUTES:
        # 跳过已有属性
        if attr_def.name in existing_attrs:
            results[attr_def.name] = {'value': existing_attrs[attr_def.name],
                                       'confidence': 1.0, 'source': 'existing'}
            continue

        extraction = extract_attribute_from_text(listing_text, attr_def)

        if extraction['confidence'] >= confidence_threshold:
            results[attr_def.name] = extraction
            auto_filled.append(attr_def.name)
        elif extraction['value'] is not None:
            results[attr_def.name] = extraction
            needs_review.append(attr_def.name)
        else:
            results[attr_def.name] = extraction
            if attr_def.required:
                not_found.append(attr_def.name)

    # 计算完整度
    total_attrs = len(BREAST_PUMP_ATTRIBUTES)
    filled_attrs = sum(1 for r in results.values() if r['value'] is not None)

    return {
        'attributes': results,
        'completeness_before': round(len(existing_attrs) / total_attrs, 2),
        'completeness_after': round(filled_attrs / total_attrs, 2),
        'auto_filled': auto_filled,
        'needs_review': needs_review,
        'not_found': not_found,
    }


def run_attribute_completion_demo():
    print('=' * 65)
    print('Product Attribute Completion — 商品属性自动补全')
    print('=' * 65)

    listing_text = """
    Ultra-Quiet Double Electric Breast Pump - USB Rechargeable Portable
    
    Whisper-quiet motor under 40dB - Perfect for office and nighttime use
    Hospital-strength dual suction with 3 suction levels and 9 intensity settings
    USB rechargeable - 2 hours full charge, 4 hours battery life
    BPA-free food-grade silicone flanges included
    Compatible with Medela breast milk storage bags
    1-year manufacturer warranty
    Lightweight at only 1.2 lbs
    """

    existing = {'pump_type': 'Double Electric'}  # 已知的一个属性

    result = complete_product_attributes(listing_text, existing_attrs=existing)

    print(f'\n📋 属性补全结果:')
    print(f'  完整度: {result["completeness_before"]:.0%} → {result["completeness_after"]:.0%}')
    print(f'  自动填充: {len(result["auto_filled"])} 个')
    print(f'  需人工复核: {len(result["needs_review"])} 个')
    print(f'  未找到: {len(result["not_found"])} 个')
    print()
    print(f'  {"属性":>28} {"值":>20} {"置信度":>8} {"状态"}')
    print('  ' + '-' * 72)
    for attr_name, info in result['attributes'].items():
        val = str(info['value'])[:18] if info['value'] is not None else '—'
        conf = f'{info["confidence"]:.0%}' if info['value'] else '—'
        status = ('✅ 自动' if attr_name in result['auto_filled']
                  else ('⚠️  复核' if attr_name in result['needs_review']
                        else ('❌ 缺失' if attr_name in result['not_found'] else '📝 已有')))
        print(f'  {attr_name:>28} {val:>20} {conf:>8}  {status}')

    print('\n[✓] Product Attribute Completion 测试通过')


if __name__ == '__main__':
    run_attribute_completion_demo()

8. 论文来源

论文链接用于核验方法来源,不自动证明本页商业结果。