Spaces:
Running
Running
fix: wrong sentences
Browse files
modules/info_extractor.py
CHANGED
|
@@ -288,8 +288,7 @@ class InfoExtractor:
|
|
| 288 |
'weekend': 2, 'week': 7, 'month': 30, 'vacation': 7, 'holiday': 3
|
| 289 |
}
|
| 290 |
|
| 291 |
-
|
| 292 |
-
"""使用分词策略进行信息提取"""
|
| 293 |
|
| 294 |
# 输入验证
|
| 295 |
if not user_message or not isinstance(user_message, str):
|
|
@@ -778,8 +777,7 @@ class InfoExtractor:
|
|
| 778 |
break
|
| 779 |
|
| 780 |
# 处理纯数字token(需要查看上下文)
|
| 781 |
-
if not amount and re.match(r'^\d+(?:\.\d+)?
|
| 782 |
-
, token):
|
| 783 |
number = float(token)
|
| 784 |
|
| 785 |
# 检查前面的token是否有预算相关词汇
|
|
|
|
| 288 |
'weekend': 2, 'week': 7, 'month': 30, 'vacation': 7, 'holiday': 3
|
| 289 |
}
|
| 290 |
|
| 291 |
+
def extract(self, user_message: str) -> dict:
|
|
|
|
| 292 |
|
| 293 |
# 输入验证
|
| 294 |
if not user_message or not isinstance(user_message, str):
|
|
|
|
| 777 |
break
|
| 778 |
|
| 779 |
# 处理纯数字token(需要查看上下文)
|
| 780 |
+
if not amount and re.match(r'^\d+(?:\.\d+)?', token):
|
|
|
|
| 781 |
number = float(token)
|
| 782 |
|
| 783 |
# 检查前面的token是否有预算相关词汇
|