feat: 제품 검색 페이지에 재고 컬럼 추가 (초록/빨강 표시)
This commit is contained in:
34
backend/scripts/debug_gesidin_match.py
Normal file
34
backend/scripts/debug_gesidin_match.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
|
||||
# 테스트 AI 응답
|
||||
ai_response = "개시딘은 피부염 치료에 사용하는 겔 형태의 외용약입니다."
|
||||
|
||||
drug_name = "(판)복합개시딘"
|
||||
|
||||
# 현재 매칭 로직
|
||||
base_name = drug_name.split('(')[0].split('/')[0].strip()
|
||||
print(f'제품명: {drug_name}')
|
||||
print(f'괄호 앞: "{base_name}"')
|
||||
|
||||
# suffix 제거
|
||||
for suffix in ['정', '액', 'L', 'M', 'S', 'XL', 'XS', 'SS', 'mini']:
|
||||
if base_name.endswith(suffix):
|
||||
base_name = base_name[:-len(suffix)]
|
||||
base_name = base_name.strip()
|
||||
print(f'suffix 제거 후: "{base_name}"')
|
||||
|
||||
# 매칭 테스트
|
||||
ai_lower = ai_response.lower()
|
||||
ai_nospace = ai_lower.replace(' ', '')
|
||||
base_lower = base_name.lower()
|
||||
base_nospace = base_lower.replace(' ', '')
|
||||
|
||||
print(f'\n매칭 테스트:')
|
||||
print(f' "{base_lower}" in ai_response? {base_lower in ai_lower}')
|
||||
print(f' "{base_nospace}" in ai_nospace? {base_nospace in ai_nospace}')
|
||||
|
||||
# 문제: (판)이 먼저 잘려서 빈 문자열이 됨!
|
||||
print(f'\n문제: split("(")[0] = "{drug_name.split("(")[0]}"')
|
||||
print('→ "(판)"에서 "("로 시작하니까 빈 문자열!')
|
||||
Reference in New Issue
Block a user