Files
msh-system/msh_crmeb_22/debug_map.py

34 lines
904 B
Python
Raw Normal View History

CATEGORY_MAP = {
"谷类及制品": "grain",
"薯类、淀粉及制品": "grain",
"干豆类及制品": "grain",
"蔬菜类及制品": "vegetable",
"菌藻类": "vegetable",
"水果类及制品": "fruit",
"坚果、种子类": "other",
"畜肉类及制品": "meat",
"禽肉类及制品": "meat",
"乳类及制品": "dairy",
"蛋类及制品": "meat",
"鱼虾蟹贝类": "seafood",
"婴幼儿食品": "other",
"小吃、甜饼": "other",
"速食食品": "other",
"饮料类": "other",
"酒类": "other",
"糖、蜜饯": "other",
"调味品": "other",
"药食": "other",
"其他": "other"
}
name = "谷类及制品"
db_category = "other"
for key, value in CATEGORY_MAP.items():
if key in name:
db_category = value
print(f"Matched key: {key} -> {value}")
break
print(f"Result: {db_category}")