Spaces:
Running
Running
SyngyeonTak commited on
Commit ·
922a84f
1
Parent(s): 8787f11
add log
Browse files- region_extractor.py +11 -6
region_extractor.py
CHANGED
|
@@ -83,7 +83,11 @@ def extract_region_from_query(user_query):
|
|
| 83 |
def format_regions(region_list):
|
| 84 |
province = None
|
| 85 |
district = None
|
|
|
|
|
|
|
| 86 |
for region in region_list:
|
|
|
|
|
|
|
| 87 |
if region.endswith(('구', '시', '군')):
|
| 88 |
if region in DISTRICT_TO_PROVINCE_MAP:
|
| 89 |
district = region
|
|
@@ -92,12 +96,13 @@ def format_regions(region_list):
|
|
| 92 |
if full_name and full_name in PROVINCE_DISTRICT_MAP:
|
| 93 |
if province is None:
|
| 94 |
province = full_name
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
result_dict
|
| 100 |
-
|
|
|
|
| 101 |
|
| 102 |
def update_region_keywords(query, state):
|
| 103 |
prev_regions = state.get("region_keywords", [])
|
|
|
|
| 83 |
def format_regions(region_list):
|
| 84 |
province = None
|
| 85 |
district = None
|
| 86 |
+
processed_list = []
|
| 87 |
+
processed_list
|
| 88 |
for region in region_list:
|
| 89 |
+
result_dict = {}
|
| 90 |
+
|
| 91 |
if region.endswith(('구', '시', '군')):
|
| 92 |
if region in DISTRICT_TO_PROVINCE_MAP:
|
| 93 |
district = region
|
|
|
|
| 96 |
if full_name and full_name in PROVINCE_DISTRICT_MAP:
|
| 97 |
if province is None:
|
| 98 |
province = full_name
|
| 99 |
+
if province:
|
| 100 |
+
result_dict["region_l1"] = province
|
| 101 |
+
if district:
|
| 102 |
+
result_dict["region_l2"] = district
|
| 103 |
+
processed_list.append(result_dict)
|
| 104 |
+
|
| 105 |
+
return processed_list
|
| 106 |
|
| 107 |
def update_region_keywords(query, state):
|
| 108 |
prev_regions = state.get("region_keywords", [])
|