ZORYE commited on
Commit
6ae0d0f
ยท
verified ยท
1 Parent(s): 5312c47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -54,19 +54,24 @@ def extract_info_block(article_text):
54
  else:
55
  return None
56
 
57
- # ๋ธŒ๋žœ๋“œ/๋ชจ๋ธ๋ช… ์—ฌ๋Ÿฌ ๊ฐœ ์ถ”์ถœ
58
  def extract_product_info(article_text):
59
- brand_match = re.search(r'<๋ธŒ๋žœ๋“œ>[ \t]*([^\n]+)', article_text)
60
- model_matches = re.findall(r'<๋ชจ๋ธ๋ช…>[ \t]*([^\n]+)', article_text)
61
-
62
- brand = brand_match.group(1).strip() if brand_match else None
63
- models = [m.strip() for m in model_matches] if model_matches else []
 
 
 
 
 
 
64
 
65
  result = []
66
 
67
  if brand and models:
68
  brand_words = re.findall(r'[A-Za-z]+', brand)
69
- selected_brand = ' '.join(brand_words[:2]) # ์•ž 2๋‹จ์–ด๋งŒ
70
 
71
  for model in models:
72
  search_query = f"{selected_brand} {model}"
 
54
  else:
55
  return None
56
 
 
57
  def extract_product_info(article_text):
58
+ brand = None
59
+ models = []
60
+
61
+ lines = article_text.splitlines()
62
+ for line in lines:
63
+ line = line.strip()
64
+ if line.startswith('<๋ธŒ๋žœ๋“œ>'):
65
+ brand = line.replace('<๋ธŒ๋žœ๋“œ>', '').strip()
66
+ elif line.startswith('<๋ชจ๋ธ๋ช…>'):
67
+ model = line.replace('<๋ชจ๋ธ๋ช…>', '').strip()
68
+ models.append(model)
69
 
70
  result = []
71
 
72
  if brand and models:
73
  brand_words = re.findall(r'[A-Za-z]+', brand)
74
+ selected_brand = ' '.join(brand_words[:2])
75
 
76
  for model in models:
77
  search_query = f"{selected_brand} {model}"