From 5e995d1208be1ad93aa0d2606ea5607e1f31076e Mon Sep 17 00:00:00 2001 From: hyungi Date: Thu, 16 Oct 2025 07:02:14 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20REDUCING=20FLANGE=20=EB=B6=84?= =?UTF-8?q?=EB=A5=98=20=EB=A1=9C=EC=A7=81=20=EA=B0=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 다양한 REDUCING FLANGE 패턴 대응 (REDUCING FLANGE, RED FLANGE, REDUCER FLANGE 등) - FLANGE + REDUCING 조합 키워드 감지 로직 추가 - 우선순위 검사 강화로 FITTING 분류 오류 방지 - 원인: REDUCER 키워드로 인한 FITTING 분류 문제 해결 --- backend/app/services/integrated_classifier.py | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/backend/app/services/integrated_classifier.py b/backend/app/services/integrated_classifier.py index d3f9559..1d66cc6 100644 --- a/backend/app/services/integrated_classifier.py +++ b/backend/app/services/integrated_classifier.py @@ -129,10 +129,31 @@ def classify_material_integrated(description: str, main_nom: str = "", # 1단계: Level 1 키워드로 타입 식별 detected_types = [] - # 특별 우선순위: REDUCING FLANGE 먼저 확인 - if "REDUCING FLANGE" in desc_upper or "RED FLANGE" in desc_upper: + # 특별 우선순위: REDUCING FLANGE 먼저 확인 (강화된 로직) + reducing_flange_patterns = [ + "REDUCING FLANGE", "RED FLANGE", "REDUCER FLANGE", + "REDUCING FLG", "RED FLG", "REDUCER FLG" + ] + + # FLANGE와 REDUCING/RED/REDUCER가 함께 있는 경우도 확인 + has_flange = any(flange_word in desc_upper for flange_word in ["FLANGE", "FLG"]) + has_reducing = any(red_word in desc_upper for red_word in ["REDUCING", "RED", "REDUCER"]) + + # 직접 패턴 매칭 또는 FLANGE + REDUCING 조합 + reducing_flange_detected = False + for pattern in reducing_flange_patterns: + if pattern in desc_upper: + detected_types.append(("FLANGE", "REDUCING FLANGE")) + reducing_flange_detected = True + break + + # FLANGE와 REDUCING이 모두 있으면 REDUCING FLANGE로 분류 + if not reducing_flange_detected and has_flange and has_reducing: detected_types.append(("FLANGE", "REDUCING FLANGE")) - else: + reducing_flange_detected = True + + # REDUCING FLANGE가 감지되지 않은 경우에만 일반 키워드 검사 + if not reducing_flange_detected: for material_type, keywords in LEVEL1_TYPE_KEYWORDS.items(): type_found = False # 긴 키워드부터 확인 (FLANGE BOLT가 FLANGE보다 먼저 매칭되도록)