Update app.py
Browse files
app.py
CHANGED
|
@@ -54,24 +54,19 @@ def extract_info_block(article_text):
|
|
| 54 |
else:
|
| 55 |
return None
|
| 56 |
|
|
|
|
| 57 |
def extract_product_info(article_text):
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
for
|
| 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}"
|
|
|
|
| 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}"
|