[Python] How to map HS code products to Alibaba categories?

Discussão em 'Python' iniciado por Stack, Abril 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to map a list of products (based on HS codes) to the closest Alibaba categories. I have two json files, one contains hierarchical product data based on HS codes

    Example:

    [
    {
    "key": "01",
    "product_name": "Animals; live",
    "children": [
    {
    "key": "0101",
    "product_name": "Live horses, asses, mules and hinnies"
    //...
    }
    ]
    // ...
    }
    // ...
    ]


    And the other file contains Alibaba's category hierarchy

    Example:

    [
    {
    "id": 0,
    "name": "Apparel & Accessories",
    "sub": [
    {
    "id": 0,
    "name": "Men's Clothing",
    "sub": [
    {
    "title": "Men's T-Shirts"
    },
    {
    "title": "Men's Jeans"
    }
    ]
    },
    // ...
    ]
    }
    // ...
    ]


    I've tried to do this with SentenceTransformers to calculate semantic similarity between each HS product name and Alibaba category title, but I get inconsistent results. (Products from the same parent category are being mapped to totally different Alibaba categories, which doesn't make sense)

    I would very appreciate any help on this!

    Continue reading...

Compartilhe esta Página